Kotlin is a new JVM-based language that can be seen as the extended language of Java, developed by JetBrains, who first saw him in the company's Android team when they saw them using the Kotlin to develop Android, suddenly feeling curious, and then slowly studied the prophecy.
Why to develop and use the Kotlin language, the official saying is:
Concise safeversatileinteroperable
And cite an example:
Nullif for youfun calculatetotal (obj:any) { if (obj is Invoice) { obj.calculatetotal () }}
See here I probably understand, and then I want to say: roll
Installation:
One: in click Download kotlin download Kotlin binary files or drag the source on GitHub, I am using the source code compiled, but the result is the following structure:
Second: Start configuring environment variables:
Export kotlin_home=xxxxxxx/kotlincexport PATH=${path}:${kotlin_home}/bin
Very basic environment variables, Linux, not much to say.
Three: Write HelloWorld (hello.kt):
Fun Main (args:array<string>) { println ("Hello, world!" )}
Four: Start compiling and running:
KOTLINC-JVM hello.kt-include-runtime--jar Hello.jar
At this point, we've written out a HelloWorld code using the Kotlin syntax, and we've compiled a jar, and it's going to run directly with main, and then we'll start analyzing the jar:
We see that the jar that it generates is also a Java class containing a main, and the main method in Java can be final decorated.
(original) Java extension language:. Kotlin Practice-Basic installation and use