1.PHP代码在线运行工具(tool.lu)为什么不能换行 代码如下和结果在补充里面。源码
2.vtkå¨Java2ä¸ç使ç¨
3.å¦ä½å¦ä¹ Kotlinç¼ç¨è¯è¨
PHP代码在线运行工具(tool.lu)为什么不能换行 代码如下和结果在补充里面。源码波段捉妖公式源码
查看解析后的源码台服gm源码源代码,如果有br标签,源码thml表白源码那是源码springboot源码编译浏览器兼容问题,或者js问题!源码网站源码可视最好本地编辑器写代码,源码然后测试访问……另外索性数组这样定义不推荐,源码php7直接[]定义,源码传统索引数组array()定义……
vtkå¨Java2ä¸ç使ç¨
ããVTK(Visualization ToolKit)æ¯ä¸ä¸ªå¼æ¾æºç èªç±è·åçè½¯ä»¶ç³»ç» å ¨ä¸ççæ°ä»¥å计çç 究人ååå¼å人åç¨å®æ¥è¿è¡ D计ç®æºå¾å½¢ å¾åå¤ç å¯è§å VTKå å«ä¸ä¸ªc++ç±»åº ä¼å¤çç¿»è¯æ¥å£å± å æ¬Tcl/Tk Java Python ããããVisualization Toolkit æ¯ä¸ä¸ªç¨äºå¯è§ååºç¨ç¨åºæé ä¸è¿è¡çæ¯æç¯å¢ å®æ¯å¨ä¸ç»´å½æ°åºOpenGL çåºç¡ä¸éç¨é¢å对象ç设计æ¹æ³åå±èµ·æ¥ç å®å°æ们å¨å¯è§åå¼åè¿ç¨ä¸ä¼ç»å¸¸éå°çç»èå±è½èµ·æ¥ 并å°ä¸äºå¸¸ç¨çç®æ³å°è£ èµ·æ¥ æ¯å¦Visualization Toolkit å°æ们å¨è¡¨é¢é建ä¸æ¯è¾å¸¸è§çMarching Cubes ç®æ³å°è£ èµ·æ¥ ä»¥ç±»çå½¢å¼ç»æ们以æ¯æ è¿æ ·æ们å¨å¯¹ä¸ç»´è§åç¹éµæ°æ®è¿è¡è¡¨é¢é建æ¶å°±ä¸å¿ åéå¤ç¼åMarchingCubes ç®æ³ç代ç èç´æ¥ä½¿ç¨Visualization Toolkit ä¸å·²ç»æä¾çvtkMarchingCubes ç±»ããããVisualization Toolkit æ¯ç»ä»äºå¯è§ååºç¨ç¨åºå¼åå·¥ä½çç 究人åæä¾ç´æ¥çææ¯æ¯æçä¸ä¸ªå¼ºå¤§çå¯è§åå¼åå·¥å · å®ä»¥ç¨æ·ä½¿ç¨çæ¹ä¾¿æ§åçµæ´»æ§ä¸ºä¸»è¦åå å ·æå¦ä¸çç¹ç¹ ãããã ) å ·æ强大çä¸ç»´å¾å½¢åè½ Visualization Toolkit æ¢æ¯æåºäºä½ç´ Voxel basedrendering çä½ç»å¶Volume Renderingåä¿çäºä¼ ç»çé¢ç»å¶ ä»èå¨æ大çæ¹åå¯è§åææçåæ¶åå¯ä»¥å åå©ç¨ç°æçå¾å½¢åºåå¾å½¢ç¡¬ä»¶ãããã ) Visualization Toolkit çä½ç³»ç»æä½¿å ¶å ·æé常好çæµstreaming åé«éç¼åcaching çè½å å¨å¤ç大éçæ°æ®æ¶ä¸å¿ èèå åèµæºçéå¶ãããã ) Visualization Toolkit è½å¤æ´å¥½çæ¯æåºäºç½ç»çå·¥å ·æ¯å¦Java åVRML éçWeb åInternet ææ¯çåå±Visualization Toolkit æçå¾å¥½çåå±åæ¯ãããã ) è½å¤æ¯æå¤ç§çè²å¦OpenGL çãããã ) Visualization Toolkit å ·æ设å¤æ å ³æ§ä½¿å ¶ä»£ç å ·æè¯å¥½çå¯ç§»æ¤æ§ãããã ) Visualization Toolkit ä¸å®ä¹äºè®¸å¤å® è¿äºå®æ大çç®åäºç¼ç¨å·¥ä½å¹¶ä¸å 强äºä¸è´ç对象è¡ä¸ºãããã ) Visualization Toolkit å ·ææ´ä¸°å¯çæ°æ®ç±»å æ¯æ对å¤ç§æ°æ®ç±»åè¿è¡å¤çãããã ) æ¢å¯ä»¥å·¥ä½äºWindows æä½ç³»ç»åå¯ä»¥å·¥ä½äºUnix æä½ç³»ç»æ大çæ¹ä¾¿äºç¨æ·ããããä¸é¢ä»ç»ä¸ä¸VTKå¨JDK _ ä¸ç使ç¨æ¹æ³ ãããã ) ä»vtkçç½ç«()ä¸ä¸è½½ææ°ç软件å çæ¬æ¯ ç¶åæå®å®è£ å°C:\vtk \ç®å½ä¸ãããã ) ä»Sunå®æ¹ä¸è½½é¾æ¥ çæ¬ _ ç¶åå®è£ å°C:\j sdk _ ä¸ãããã ) 设置ç¯å¢åé ç³»ç» >é«çº§ >ç¯å¢åé >path 设置为C:\j sdk _ \bin;C:\ProgramFiles\Java\j re _ \bin;C:\j sdk _ \jre\bin;C:\vtk \binãããã ) æ·è´C:\vtk \bin\*java dllå°ç³»ç»ç®å½ãããã ) ç¼è¯ è¿è¡ 为äºæ¹ä¾¿èµ·è§ æ·è´C:\vtk \Examples\Tutorial\Step \Javaç®å½ä¸çCone javaå°dç å½åç®å½ä¸ºdçããããD:\>javac classpath c:\vtk \bin\vtk jar Cone javaããããD:\>java classpath ;c:\vtk \bin\vtk jar Coneããããæºç å¦ä¸ ãããã//ãããã// This 源码example creates a polygonal model of a cone and then renders it toãããã// the screen It will rotate the cone degrees and then exit The basicãããã// setup of source > mapper > actor > renderer > renderwindow is ãããã// typical of most VTK programs ãããã//ãããã// We import the vtk wrapped classes first ããããimport vtk *;ãããã// Then we define our class ããããpublic class Cone { ããããã// In the static contructor we load in the native code ããããã// The libraries must be in your path to work ãããããstatic { ããããããSystem loadLibrary( vtkCommonJava ); ããããããSystem loadLibrary( vtkFilteringJava ); ããããããSystem loadLibrary( vtkIOJava ); ããããããSystem loadLibrary( vtkImagingJava ); ããããããSystem loadLibrary( vtkGraphicsJava ); ããããããSystem loadLibrary( vtkRenderingJava ); ããããã}ããããã// now the main programãããããpublic static void main (String []args) { ãããããã// ãããããã// Next we create an instance of vtkConeSource and set some of itsãããããã// properties The instance of vtkConeSource cone is part of aãããããã// visualization pipeline (it is a source process object); it produces dataãããããã// (output type is vtkPolyData) which other filters may process ãããããã//ããããããvtkConeSource cone = new vtkConeSource();ããããããcone SetHeight( );ããããããcone SetRadius( );ããããããcone SetResolution( );ãããããã // ãããããã// In this example we terminate the pipeline with a mapper process object ãããããã// (Intermediate filters such as vtkShrinkPolyData could be inserted inãããããã// beeen the source and the mapper )ãWe create an instance ofãããããã// vtkPolyDataMapper to map the polygonal data into graphics primitives Weãããããã// connect the output of the cone souece to the input of this mapper ãããããã//ããããããvtkPolyDataMapper coneMapper = new vtkPolyDataMapper();ããããããconeMapper SetInput( cone GetOutput() );ãããããã// ãããããã// Create an actor to represent the cone The actor orchestrates renderingãããããã// of the mapper s graphics primitives An actor also refers to propertiesãããããã// via a vtkProperty instance and includes an internal transformationãããããã// matrix We set this actor s mapper to be coneMapper which we createdãããããã// above ãããããã//ããããããvtkActor coneActor = new vtkActor();ããããããconeActor SetMapper( coneMapper );ãããããã//ãããããã// Create the Renderer and assign actors to it A renderer is like aãããããã// viewport It is part or all of a window on the screen and it isãããããã// responsible for drawing the actors it has ãWe also set the backgroundãããããã// color hereãããããã//ããããããvtkRenderer ren = new vtkRenderer();ããããããren AddActor( coneActor );ããããããren SetBackground( );ãããããã//ãããããã// Finally we create the render window which will show up on the screenãããããã// We put our renderer into the render window using AddRenderer We alsoãããããã// set the size to be pixels by ãããããã//ããããããvtkRenderWindow renWin = new vtkRenderWindow();ããããããrenWin AddRenderer( ren );ããããããrenWin SetSize( );ãããããã//ãããããã// now we loop over degreeees and render the cone each timeãããããã//ããããããint i;ããããããfor (i = ; i < ; ++i)ããããããã{ ããããããã// render the imageãããããããrenWin Render();ããããããã// rotate the active camera by one degreeãããããããren GetActiveCamera() Azimuth( );ããããããã}ãããããã} ãã} lishixinzhi/Article/program/Java/JSP//
å¦ä½å¦ä¹ Kotlinç¼ç¨è¯è¨
为ä»ä¹è¯´ Kotlin æ¯ä¼ç§ç
æ¬æä¸ä¼åä¸è¬ä»ç»è¯è¨çæç« é£æ ·ï¼ä¸å¼å¤´å°±ç½ååºè¯è¨é£äºé ·ç«çç¹æ§ï¼æ们ç¨ååæ¥æ¢è®¨è¿äºå 容ã
é¦å æå°ä»ç»ä¸äºå ¶å®çä¿¡æ¯ï¼å 为 å¹´ä¸é¡¹ç 究æ¾ç¤ºï¼å½å¼åè è¯ä¼°ä¸ç§ç¼ç¨è¯è¨æ¶çæç³»ç»è¦æ¯è¯è¨ç¹æ§æ´éè¦ãè¿ç¬¦åæ个人çç»éªï¼ä¸é¢å°±è®©æå¼å§ä»ç»å§ï¼
Kotlin 被ç¼è¯æ JVM åèç æè JavaScript 代ç ãJava å¼åè å°ä¼æ¯å¯¹å®ææå ´è¶£ç人ï¼ä¸è¿å¯¹äºä½¿ç¨åå¾æ¶éè¿è¡æ¶è¯è¨çå¼åè èè¨å®ä¹å ·æä¸å®çå¸å¼åï¼æ¯å¦ ScalaãGoãPythonãRuby å JavaScript çè¯è¨ã
Kotlin æ¥èªä¸çï¼èä¸æ¯å¦æ¯çãå®è§£å³äºå¼åè ç°ä»é¢ä¸´çå®é é®é¢ãä¾å¦å®çç±»åç³»ç»å¯ä»¥å¸®å©ä½ é¿å 空æéå¼å¸¸ã
åæ¢å° Kotlin æ éææ¬ï¼å®æ¯å¼æºçä½è¿ä¸æ¯éç¹ï¼éç¹æ¯å®æä¾äºä¸ä¸ªé«è´¨éçä¸é®ä» Java 转æ¢å° Kotlin çå·¥å ·ï¼å¹¶ä¸ååå ³æ³¨ Java äºè¿å¶æ件çå ¼å®¹æ§ãä½ å¯ä»¥å°ç°æ Java 项ç®çä¸æ¬¡æ§è½¬æ¢æ Kotlin 项ç®ï¼è该项ç®ä»å°å¯ä»¥æ£å¸¸ç¼è¯ï¼å³ä½¿è¿æ¯ä¸ä¸ªå å«ä¸ç¾ä¸è¡ä»£ç çå¤æç¨åºã
æ¾ç¶ä½ å¯ä»¥ä»ä¸æå¾ç¥ï¼Kotlin ç¨åºè½å¤ä½¿ç¨ææç°åç Java æ¡æ¶ååºï¼çè³é£äºä¾èµæ³¨è§£å¤ççé«çº§æ¡æ¶ãå®ä»¬ä¹é´ç交äºæ¯æ ç¼çï¼ä¸éè¦å è£ æè éé å±ãKotlin å¯ä»¥æ´å Mavenï¼Gradle 以åå ¶å®æ建系ç»ã
å®ååå¹³æè¿äººï¼è¯æ³ç²¾ç¼ç´è§ï¼ä» ä» æ¯é 读è¯è¨åèææ¡£å 个å°æ¶å°±è½å¦ä¼ä½¿ç¨ãKotlin çèµ·æ¥ååå Scala ä½æ¯æ´å ç®æ´å¹¶ä¸å ¼é¡¾äºå¯è¯»æ§ã
å®ä¸éµå¾ªç¹å®çç¼ç¨å²å¦ï¼ä¾å¦æ度çå½æ°å¼ç¼ç¨æè é¢å对象ç¼ç¨é£æ ¼ã
å®ä¸ä¼å¢å è¿è¡æ¶çå¼éãKotlin çæ ååºååå°å·§ç´§åï¼ä¸æ³¨äºæ©å± Java æ ååºï¼ç¼è¯é¶æ®µç大éå èæä½æå³å map/filter/reduce ç管éç»æå½æ°å°è¢«ç¼è¯æ类似äºå½ä»¤å¼è¯è¨ç代ç ã
Anko ä¸ Kovenant çæ¡æ¶çåºç°æå³çå¨ Android å¼åè ä¸ Kotlin å¼å§åå¾æµè¡èµ·æ¥ãå¦æä½ æ£å¨ä»äº Android ç¸å ³çå·¥ä½ï¼ç¸ä¿¡ä½ å¾å¿«å°±ä¼è·å¾å¥½çå·¥ä½ãä½ å¯ä»¥é 读è¿ä»½ Square å ¬å¸å¼åè JakeWharton çæ¥åï¼äºè§£ç¨ Kotlin è¿è¡ Android å¼åçä½éªã
Kotlin å è®¸ä½ ç»§ç»ä½¿ç¨ä½ çå·¥ä½æçæåå·¥å ·ãIntelliJ ç IDE 对 Kotlin çæ¯æååå®åï¼ä½ å¯ä»¥å¯¹ä»£ç è¿è¡éæãæç´¢ã导èªä»¥å使ç¨èªå¨å®æï¼èä¸ IDE å åæ¯æè°è¯ãåå æµè¯ãæ§è½åæççåè½ã
é¤äº Androidï¼æ认为 Kotlin è¿é常éç¨äºä¼ä¸ä¸ Java çåºç¨åºæ¯ãå¦æä½ çå·¥ä½æ¯æ´å¤©å头äºå¤§å ¬å¸ç代ç åºä¸ï¼é£ä¹å½ Kotlin 1.0 çæ¬æ£å¼åå¸æ¶ä½ åºè¯¥å°½å¿«å»äºè§£ä¸ä¸ï¼
ç±ç¥åå ¬å¸ä¸ºå®æä¾å¼ºå¤§çåä¸æ¯æã JetBrains è¿å®¶å ¬å¸ æä¸ä¸ªé«åº¦ç§°èç大å¢éè´åäºè¯¥é¡¹ç®ï¼æ稳å®çåä¸æ¨¡å¼çè³å¨èªå·±çé¨åæè°äº§åä¸ä½¿ç¨ Kotlinï¼è¿è¡¨æçæå Kotlin ä¸ä¼è¢«æ¾å¼ã
ä½¿ç¨ Kotlin é£é©è¾ä½ï¼å¯ä»¥ç±ä¸ä¸¤ä¸ªæå ´è¶£çå¢éæåå¨é¡¹ç®ä¸å°èå´çè¯éª Kotlinï¼è¿å¹¶ä¸ä¼æ°ä¹±ä½ ç项ç®ï¼å 为 Kotlin ç类对å¤æä¾ç Java API çèµ·æ¥å°±ä¸æ®éç Java 代ç ä¸æ ·ã
å 为 Kotlin åå注éè¯æ³çå¯è¯»æ§ï¼ä»£ç 审æ¥ä¸ä¼æ为é®é¢ï¼å¯¹ Kotlin ä¸çæçå¢éæåä»ç¶è½å¤å®æ该工ä½ã
Kotlin åºäº Java 6ï¼æ以åå¦ä½ é¾ä»¥å¨é¡¹ç®ä¸å级使ç¨æ°çæ¬ç JVMï¼ä½ å¯ä»¥ä½¿ç¨ Kotlinã
ä»å¹´æ©äºæ¶åæå Swiss Re è¿å®¶ç士åä¿é©å ¬å¸çå¢éï¼ä»ä»¬ä½¿ç¨ Java å .NETï¼å±ç¤ºäº Kotlinãé¦å æå®ä¹äºä¸ä¸ªç®åç Java ç±»å å«ä¸äºå段以å toStringãequalsãhashCode çæ¹æ³ï¼å¤§æ¦æ è¡ä»£ç ãç¶åæå°å®è½¬æ¢æ Kotlin 代ç ï¼å¤§é¨åæ¯èªå¨å®æçï¼ï¼ç»æä» å© 1 è¡ä»£ç ï¼æ¥çæè¿æ¼ç¤ºäºå ¶å®èçæ¶é´çç¹æ§ãä»ä»¬çè¿å对 Kotlin å 满äºçæ 并ä¸è®¤ä¸º Kotlin æ¯å®ä»¬é¡¹ç®ä¸ C# è¯è¨çä¸ä¸ªæ½å¨ç«äºå¯¹æã
æ认为 Kotlin æ£ä¸ä¼ä¸ Java å¼åè ç红å¿ï¼æ以尽管 Kotlin æ¯å è´¹çï¼JetBrains è¿æ¯è½å¤éè¿å®å¢å åä¸çæ¬ IDE çéå®æ¥èµå¤§é±ãè¿å°æ¿å±ä»ä»¬æ ¹æ®ç¨æ·çææ¿æç»æ¹è¿å®ã
ä¸æ¤ç¸æ¯ï¼å¯¹äºé£äºç±ä¸ç¸å ³äº§åèµå©çè¯è¨å¼åè æ¥è¯´ï¼å½ç¨æ·éæ±ä¸ä¹åç设计ç念å²çªæ¶ï¼ä»ä»¬å¾å°ä¼å æ¤ä½åºè°æ´ã
ç¹æ§
Kotlin ä½ä¸ºä¸é¨æ°çç¼ç¨è¯è¨è½å¤è±é¢èåºï¼æ¯å 为å®å ³æ³¨çæç³»ç»ï¼JetBrains æå¾ç产åçé«ä½æ´å¤çåå³äºçæç³»ç»èä¸æ¯ä¾¿æ·çè¯æ³ã
尽快å¦æ¤ï¼Kotlin è¿æ¯æ许å¤æç¨çç¹æ§è½è®©ä½ ç¼ç çè¿ç¨åå¾æå¿«ï¼
æ们已ç»æè¿ null å®å ¨ï¼å¯éï¼ï¼å®è½å¤è®©ç¼è¯å¨ç³»ç»çæ è®°æ½å¨ç空æéå¼ç¨ãä¸ä¸äºè¯è¨ä¸åçæ¯å®ä¸æ¶å option ç±»ï¼å æ¤æ¯é¶å¼éçï¼å¹¶ä¸è¿æå ¶å®è¯è¨ç¹æ§ç¡®ä¿å®ä¸ä¼é æä¸ä¾¿ã
ç²¾ç¼çè¯æ³ï¼æ å¤ä¸å¨çç±»åæ¨æãç®åçå½æ°åªéè¦ä¸è¡ãç®åçç»æ以å JavaBeans ä¹åªéè¦ä¸è¡å°±è½å£°æãçæ£çå±æ§ââå¯ä»¥å¨èåèªå¨çæ getFoo/setFoo æ¹æ³ç¨äºä¸ Java è¿è¡äº¤äºãå½æ°å¯ä»¥ç¬ç«åå¨äºç±»ä¹å¤ã
å¼å¸¸å为éæ£æ¥åãï¼è¯è 注ï¼æå ´è¶£çå¯ä»¥é 读ä¸ä¸Java ç论ä¸å®è·µ: å ³äºå¼å¸¸çäºè®ºï¼
ä½¿ç¨ data class å ³é®åå建æ°æ®ç±»ä¼èªå¨çæéç¨æ¹æ³ï¼ä¾å¦ equalsãhashCodeãtoString 以å copy å componentNï¼åæ¶å£°æå¤ä¸ªåéæ¶ä¼è°ç¨è¯¥æ¹æ³ï¼ãè¿å°å¸®å©ä½ å¨ä¸ä½¿ç¨æ建å¨çæ åµä¸ä¾¿æ·çè·å¾ä¸åç±»ï¼immutable classesï¼ã
ä½å¦æä½ éè¦æé å¤æçç»æä½ï¼åå©ç±»åå®å ¨çæ建å¨è¿ä¸ªç¹æ§å¯ä»¥ç®æ´çå®ç°ãå¦æä½ ä½¿ç¨ Google Protocol Buffers æ¥åå¨ç»æåæ°æ®ï¼ éè¿ KBuilders è¿ä¸ªåºä¹è½å¾è½»æåå°ã
æ¯æå½æ°å¼ç¼ç¨ä»¥åé¶å¼éç lambda 表达å¼ï¼è½å¤å¨ Java çéåä¸å MapãFilterãFolder çå¤çãKotlin çç±»åç³»ç»è½å¤èªå¨è¯å«å¯åæè ä¸å¯åçéåã
æ©å±å½æ°ç¹æ§è½å¤è®©ä½ å¨ä¸æ¹å¨æºç çæ åµä¸ä¸ºç±»æ·»å æ¹æ³ãä¹ç¼ä¸ç以为æ¯ä¸ºäºé¿å ååºå FooUtils è¿ç§é£æ ¼å·¥å ·ç±»çè¯æ³ç³ï¼ä¸è¿éç使ç¨çå æ·±ï¼ä½ ä¼è®¤è¯å°å®ä¸ä» è½å¸®ä½ æ´å 容æçéè¿èªå¨å®æ使ç¨æ¹æ³ï¼è¿è½åå©ä½ éæç°æç Java API 以ååå©å ¶å® Kotlin ç¹æ§æ建åè½å¼ºå¤§çæ©å±ã
æ¯æè¿ç®ç¬¦éè½½ï¼ä½æ¯ä¸ä¼å Scala æè Perl é£æ ·åºç°é¾ä»¥ç解ç代ç ãè¿ç®ç¬¦è¢«æ å°æç¸åºååçæ¹æ³ï¼éè¿éåè¿äºæ¹æ³æ¹åè¿ç®ç¬¦çè¡ä¸ºï¼å æ¬å½æ°è°ç¨ï¼ï¼ä½æ¯ä¸è½å®ä¹æ°çè¿ç®ç¬¦ãè¿ä½¿å¾ç¨åºè½å¤å ¼é¡¾åè½ä¸å¯è¯»æ§ã
Kotlin 没æå®æè å ¶å®çæ¹å¼æ¥éå®ä¹è¯è¨ï¼ä½æ¯éè¿è¿äºç²¾å¿è®¾è®¡çç¹æ§è½å¤ä½¿ç¬¬ä¸æ¹åºèªç±ç对å®è¿è¡æ©å±ï¼å®æ¹å¯¹éåç±»è¿è¡çæ©å±ä¹åªæ¯å°è¯çåèå·²ï¼è¯·ç以ä¸ä¾åã
æ³ä½¿ç¨ fibersãactors å Go é£æ ¼ç channelsï¼ä¸ä¸ªå为 Quasar çåºå·²ç»ä¸ºä½ å®ç°äºã
ä½¿ç¨ Markdown æ¿ä»£ HTML æ¥ç¼å API ææ¡£ï¼è¿æ ·ç¼å JavaDocs å¯æ¯ä»¥åèéå¤äºãï¼è¯è 注ï¼JetBrains æä¾äºç¸åºçææ¡£çæå¨ Dokkaï¼
æ´å¥½ç¨çæ³åãå¦æä½ æ²¡æå®å ¨ææ¡æ³ååæ°ä¸ super 以å extends çå«ä¹ï¼å«æ å¿ï¼è¿ä¸æ¯ä½ çéãJava çæ³åç确令人费解ï¼Kotlin 解å³äºè¿ä¸ªé®é¢ã
å§ææ¯ä¸ä¸ªå¤§å®¶é½ç¥éç设计模å¼ï¼Kotlin åçæ¯æå®ã
== è¿ç®ç¬¦çè¡ä¸ºç¬¦åé¢æï¼è¯è 注ï¼ç®åæ¥è¯´ a == b ç¸å½äº a.equals(b)ï¼æ°å¢äº === è¿ç®ç¬¦ï¼ç¨æ¥å¤æè¿ç®ç¬¦ä¸¤è¾¹æ¯å¦æååä¸ä¸ªå¯¹è±¡ï¼
æ³å¿«é便æ·çè¿è¡å¼æ¥ç¼ç¨åï¼å½ç¶ï¼
å符串æå¼âå¯ä»¥ä½¿ç¨è¿æ ·çåæ³å¨å符åä¸ç´æ¥å¼ç¨åé { this.example}â
å½æ°ä¸çåæ°å¯ä»¥æå®é»è®¤å¼ã使ç¨å¯åé¿åº¦ä»¥åéè¿åæ°åä¼ åã
è¿æ许å¤çè°æ´ä¸ä¼åãåå¦ Java ä¸ææäºè®©ä½ è§å¾å°æ°çé®é¢ï¼æç¸ä¿¡ Kotlin ä¸å®å·²ç»æå®å¤ç好äºã
ç°å¨å°±æ¥è¯ç¨ä¸ä¸ï¼
è·å¾å¤ç°ä»£ç¼ç¨è¯è¨ä¸æ ·ï¼Kotlin å¯ä»¥éè¿ç½é¡µæµè§å¨æ¥è¿è¡ä½éªãä¸è¿è·å ¶ä»è¯è¨ä¸ä¸æ ·çæ¯ï¼Kotlin çå®éªç½ç«æä¾äºä¸ä¸ªæçç IDEï¼å æ¬ååºå¾å¿«çèªå¨å®æï¼å®æ¶çåå°ç¼è¯ï¼çè³è¿æå¨çº¿çéæåæï¼
å¨çº¿è¯ç¨ä¸ä¸å§
好äºï¼è®©æ们继ç»æ¥ä¸æ¥çå 容
ç®ååå¨åªäºé®é¢ï¼
çæ´»ä¸æ²¡æä»ä¹æ¯å®ç¾çï¼å æ¬ Kotlinã以ä¸æ¯æå°è¯è¿é¨è¯è¨æ¶éå°çä¸äºé®é¢ã
æ大çé®é¢æ¯ä¸å¤æçï¼å 为 Kotlin ç®åè¿å¤äº Beta é¶æ®µï¼è¿æå³çï¼
æ¯æ´æ°ä¸ä¸ªçæ¬ï¼è¯æ³ãABI 以åæ ååºå°±åä¸æ¬¡ã好æ¶æ¯æ¯è¿äºååé常æ¯è¾å¾®å°ï¼å¯ä»¥åå© IntelliJ IDE æ¥èªå¨åçº§ä½ ç代ç ï¼æ以è¿ä¸ªè¿ç¨å¹¶ä¸ä¼å¤ªéº»ç¦ã
Java-to-Kotlin ç转æ¢å·¥å ·ï¼J2Kï¼è¿æ²¡æå®æãå®å¶å°ä¼å¤§è§æ¨¡çç ´ååé»é»å°æ¦é¤ Java 8 ä¸ç Lambdasï¼ä¿®æ¹ï¼ å¹´ æï¼M çæ¬ç转æ¢å·¥å ·å·²ç»å¯ä»¥æ£ç¡®å°å¤ç Java 8 çç¹æ§äºï¼ãç±å®è½¬æ¢èæç代ç 并ä¸æ»æ¯æ好çåæ³ï¼ä½æ¯ JetBrains 为è¿ä¸ªå·¥å ·ä»åºäºå¤§éåªåï¼å®å·²ç»æ¯æç¨è¿çè¯è¨è½¬æ¢å·¥å ·ä¸æ好çäºãæ以æ并ä¸å¤ªæ å¿è¿ä¸ªé®é¢ï¼è¿ä¸ªè½¬æ¢å¨æ£å¨è¿ éçæ¹è¿ä¸ï¼åå¾è¶æ¥è¶æçã
ä½ ä¼éå°ç¼è¯å¨é误ã尽管æçç¨åºå¹¶ä¸å¤§ï¼ä½è¿æ¯ä¼åçæ æ³ç¼è¯çæ åµï¼çè³é误çç¼è¯ç»æãè¯æè¿äºé®é¢å¹¶ä¸é¾ï¼ä½ç»å½è¿æ¯å½±åäºå¼åçä½éªã
ä½ ä¼éå° IDE å é¨é误ãå½è¿ä¸ªé误åçæ¶ï¼IntelliJ IDE ä¼å¼¹åºä¸ä¸ªæ¬æµ®çªå£ï¼é带å JetBrains æ¥åçé项ã大é¨åé误æ éçä¼ï¼ä¸è¿ä¾ç¶ä¼ä½¿äººåç¦ã
å¶å°ä¼åºç°æ æ³å è½½æ示ææ¡£çé误ï¼ä¿®æ¹ï¼M çæ¬åå¸åï¼è¿ä¸ªé®é¢å·²è¢«ä¿®å¤ï¼
ç®å JetBrains æ£è´åäºå®ååå¸ 1.0 çæ¬èä¸æ¯æ·»å æ°çåè½ï¼æå¾ è¿äºé®é¢è½å¤å¾å°ä¿®å¤ã
第äºä¸ªæéå°çæ¯è¾å¤§çé®é¢æ¯ï¼ææ¶ä¸ Java ç交äºä¼åå°å±éã
ä¸ä¸ªå ¸åç Bug æ¯ Java çç±»åç³»ç»æ æ³é²æ¢ä½ æ¹å Map ä¸ Key çç±»åãæçæ¥è¯´ï¼è¿æ ·æä½åºè¯¥å¯¼è´ç¼è¯å¨æ¥éï¼ä¾å¦ä½¿ç¨ç±»åé误ç Key å é¤å ç´ ãæäº JDK ä¸çéå使ç¨äºæ³åï¼å®ä»¬æäºéè¦æ¹æ³çæ³ååæ°æ¯ Obejctï¼æ以ç¼è¯å¨ä¸ä¼æ示ãå½å¨ IntelliJ IDE ä¸ç¼å Java 代ç æ¶ä¼æéæåæçè¦åï¼ä½æ¯ç®å Kotlin ç¯å¢è¿æ²¡æè¿ä¸ªåè½ãå 为 Kotlin 使ç¨çæ¯ Java çéåæ¡æ¶æ²¡æèªå·±å®ç°ï¼æ以è¿å¯¼è´äºä¸äºç±»åå®å ¨æ¹é¢çé®é¢ï¼æå·²ç»éå°å¥½å 次äºã
ï¼ä¿®æ¹ï¼1.0 Beta çæ¬ä¸è¿ä¸ªé®é¢å·²ç»è§£å³äºï¼Java ä¸éåæ¡æ¶çç±»åå®å ¨ç¼ºé·å¨ Kotlin å·²ç»ä¸å¤åå¨ãååµï¼ï¼
å¦ä¸ä¸ªä¾åæ¯ï¼å½è°ç¨æä½¿ç¨ Java 代ç æ¶ Kotlin ç Null å®å ¨ç¹æ§æ æ³åæ¥ä½ç¨ï¼å¯ä»¥åå©æ³¨è§£å¼¥è¡¥ï¼ãä½ä¸º Kotlin çåå¦è ï¼åå¼å§ä½ å¯è½ä¼å许å¤è°ç¨ Java åºç代ç ï¼ä½æ¯å 为以ä¸çé®é¢å®ä»¬å¹¶æ²¡æä½ æ³è±¡ä¸é£ä¹å¥½ç¨ãè¿ç§æ åµçæ¹ååªè½çå¾ Kotlin 使ç¨äººæ°çå¢é¿ãJetBrains ä¸ç´å¨å°è¯ä½¿ Null å®å ¨ç¹æ§è½ä½ç°å¨ Java 交äºä¸ï¼è¿ç§æ³æ³æ¯å¥½çï¼ä½ææ¶èè并太å¨å ¨ãï¼ä¿®æ¹: ä» M çæ¬å¼å§ï¼å¨ Java 代ç ä¸å°èªå¨ä»¥ @NotNull @Nullable ç注解å®ç° Kotlin ç Null å®å ¨ç¹æ§ï¼
è½ç¶æ以ä¸çé®é¢åå¨ï¼ä½åæ¶ä¹ä½¿å¾æ们è½æ´æµç çä½¿ç¨ Java APIï¼æè§å¾è¿ç§æè¡¡æ¯å¼å¾çï¼åªæ¯å¨å¼åä¸è¦æ³¨æã
å ¶å®éè¦èèçé®é¢:
Kotlin ç社åºè¿æ¯è¾å°ãè½ç¶ç®å没æå¤å° Kotlin çåºå¯ä»¥ä½¿ç¨ï¼ä½æ¯ååä¼ç§ç Java 交äºè½åï¼Kotlin å¯ä»¥ä½¿ç¨ç°ææçç Java åºã
å¦æä½ å欢ç书æ¥å¦ä¹ ï¼é£ä¹ä½ éè¦çå°ä»å¹´æäºæ¶åæè½çå° Kotlin å¼åè åç书ï¼è¯è 注ï¼Kotlin in Actionï¼
纯粹çå½æ°ç¼ç¨é£æ ¼å¼åè å¯è½ä¼è§å¾ç±»åç³»ç»ä¸ç¼ºä¹ä¸äº Scala æ Haskell æ¥æçé«çº§åè½ãå¦æä½ å¯¹ç±»åç³»ç»ä¸äºåè½æ¯è¾çéï¼é£ä¹ Kotlin å¯è½ä¸éåä½ ã
Kotlin è¿è½ç¼è¯æ Javascript 代ç ï¼ä½æ¯æ¯è¾å°ç¨ï¼æ以å¯è½ä¼éå°æ´å¤çé®é¢ï¼è¿æ¯æä»è®ºåä¸å¾å°çå°è±¡ãï¼ä¿®æ¹: ç®å Kotlin çå¼åéå¿å¨äºå®æ 1.0 çæ¬å¹¶ä½¿å ¶ç¨³å®è¿è¡å¨ JVM ä¸ï¼Javascript æ¹é¢çé®é¢å°ä¼å¨ 1.0 åå¸åçæ解å³ï¼
没ææ åçç¼ç¨é£æ ¼æåï¼ç®å Kotlin æä¾äºå¤ç§è¯æ³å¯ä¾éæ©ãä¸å人ååºæ¥ç Kotlin 代ç å¾å¯è½å®å ¨ä¸ä¸æ ·ãè¿ä¸ Go ä¸¥æ ¼çé£æ ¼å½¢æäºé²æç对æ¯ãï¼ä¿®æ¹: Kotlin 1.0 çæ¬å¼å§ï¼ä¸äºçµæ´»çè¯æ³å·²ç»è¢«ç§»é¤äºï¼ä¾å¦ç°å¨éè½½è¿ç®ç¬¦ä»¥åå®ä¹ä¸ç¼å½æ°æ¶å¿ é¡»åå«ä½¿ç¨ operator å infix å ³é®åè¿è¡æ è®°ï¼
Kotlin çç¼è¯é度ç¨ç¨æ ¢äº Javaï¼ä»¥å IntelliJ IDE çæºè½æ示ååºæç¹ç¼æ ¢ï¼ä¸ç®ä¸¥éèä¸æ¯ Scala å¿«å¤äºãï¼ä¿®æ¹ï¼Kotlin 1.0 å¼å§ç¼è¯é度æäºææ¾æåï¼
Kotlin æä¸ä¸ª Eclipse æ件ï¼ä½æ¯å¾ææ¾æ²¡æ IntelliJ ç好ç¨ã
Kotlin å¨æäºæ¹é¢æ¯ Java è¦ä¸¥æ ¼ãå®ä¸ä¼èªå¨å° Int 转æ¢ä¸º Long ç±»åï¼éè¦å¼åè æ¾ç¤ºç转æ¢ãè¿æ¯å 为 Kotlin å ³æ³¨æ£ç¡®æ§åè¯å¾è§£å³ãJava Puzzlersãä¸ä¹¦ä¸æåºçé®é¢ãJetBrains 声称ä»ä»¬å·²ç»æå®ä¸åäºã
Kotlin åºäº Java 6ï¼å æ¤ä¼åå°å®çå±éãKotlin ä¸ C# å¨å¾å¤é¢åé½å¾ç¸ä¼¼çè³æ¯ C# åå¾æ´å¥½ï¼ä½æ¯å®ç¼ºå°ä¸äºåè½ï¼ä¾å¦ Java å¹³å°å°æªæ¯æçæäºæ°æ®ç±»åã
为ä»ä¹åºè¯¥å¼å§èèä½¿ç¨ JVM
æè¿ä¸æ®µæ¶é´æéå°äºå¾å¤ä½¿ç¨å¨æèæ¬è¯è¨ï¼JavaScript æè Go ââ è¯è 注ï¼Go åºè¯¥æ¯éæç¼è¯åè¯è¨ï¼çåä¸å ¬å¸ã
æå¨ Bitcoin Space å·¥ä½çæ¶åï¼ä½¿ç¨å¨æè¯è¨æ¯é常çè¦çäºæ ãå¨è¿äºè¯è¨é没æå®å ¨æ§çç±»åï¼è¿å·²ç»å¯¼è´äºå·¨å¤§çè´§å¸æ失ãGo æ¯è¾å°åºéï¼ä½æ¯å¨åºç¡å±é¢ä¸ç»äººçä½éªä¾ç¶å¾å·®ï¼æ¯å¦è¯´ç¼ºå°å¥½çè°è¯å·¥å ·ï¼å¿«é GC æºå¶ï¼ç¨³å¥ç管çå¨ä»¥åå¯é çåæå·¥å ·ã
è¿å» å¹´æè æ´é¿æ¶é´éï¼Java åå¾è¶æ¥è¶å¥å£®ï¼è¶æ¥è¶åé¿ï¼çè³æè¿åº¦è®¾è®¡ç迹象ï¼è¿äºååå¾å¤§ç¨åº¦ä¸æºäºå®ç声èªãä¼ä¸çº§ Java ç±»çåå PathVariableMapMethodArgumentResolver å°±æ¯ä¾è¯ãå¨å¾é¿ä¸æ®µæ¶é´éæ没æèè JVMï¼æ确信è¿ç§ç¯å¢å¹¶ä¸éåæã
æç»æå 为 Android 被迫åå° Javaï¼åç° Java çå¼åç¯å¢å·²ç»æ¹åäºãè½ç¶ XML ä»ç¶ä¸åæ¶å®çé¢ç¹åºç°å¨åç§åºåï¼ä½æ¯ä¸äºåºç¡åè½ååå®åï¼ä»¤äººå°è±¡æ·±å»ã IntelliJ æ¯æ¯ Eclipse æ´å¿«å¹¶ä¸æ´æºè½ç IDEãMaven ä¸åºç°å°±å¾å°äºè¿ éçåå±ï¼æ¥æ许å¤åæ¬ææ³è¦å ¶å®æ建 / ä¾èµç³»ç»å¢å çåè½ãè¾æ°ç Web æ¡æ¶å Ninja å Play ä»ç±»ä¼¼ Ruby on Rails çæ¡æ¶ä¸å¦å°äºè½»éç®æ´ãæ大éçåºå¯ä¾ä½¿ç¨ã硬件æ§è½åå¾æ´é«ä»¥å JVM åå¾æ´ææçï¼çç转åã
没æçæ£æ¹åçæ¯è¯è¨æ¬èº«ï¼Java 代ç åèµ·æ¥ä¾ç¶æ¯ä»¤äººä¸å¿«çåé¿ã
ç°å¨æäº Kotlinï¼å®å ¨æ éæ¿åç¦»å¼ Java ç°æççæç³»ç»çç¼è¦ãä½ å¯ä»¥ç¼åæ´å¯æ表ç°åç代ç ï¼ä½æ¯å´æ¯èæ¬è¯è¨æ´ç®æ´ï¼åæ¶æ¥ææ´å¥½çæ§è½åæ´å°çé误ã
å¦æä½ å欢 JavaScriptï¼å¯ä»¥å°è¯ Kotlin ç JS å端ï¼æè å¨ Nashorn JS å¼æéè¿è¡ä½ ç°æç代ç ã
æåï¼å¦æä½ å欢 Go è¯è¨æ¯å 为å®å¯ä»¥ç¼è¯ç¬ç«è¿è¡çç¨åºï¼é£ä¹è¯è¯ javapackager å·¥å ·ãKotlin å¨æ¬å°ä¸ºæ¯ä¸ªå¹³å°å建äºæç»å ï¼è¿æå³çå¨ linux ä¸ä¸éè¦ JRE çä¾èµå°±å¯ä»¥ç¬ç«èªä¸»çè·å DEBsï¼linux çå®è£ å ï¼æè å缩å ãå½ç¶ï¼å®æå ä¹åä¸æ¯å个æ件èæ¯å个ç®å½ï¼ä»é¨ç½²çè§åº¦æ¥ç并ä¸é¾æä½ã
ç®èè¨ä¹ï¼å¦æä½ ä¹åå 为ç Java ä¸é¡ºç¼è忽ç¥äº JVM ççæç³»ç»ï¼é£ä¹ä½ åºè¯¥åç Kotlin è¿é¨æ°è¯è¨è¿å ¥è¿ä¸ªä¸çç§ç§ã