A modern programming language
that makes developers happier.
Open source forever Github
Try out the latest Kotlin features before they are released
fun main() {
println("Hello World")
}
class Greeter(val name: String) {
fun greet() {
println("Hello, $name")
}
}
fun main(args: Array<String>) {
Greeter(args[0]).greet()
}
import kotlinx.coroutines.*
//sampleStart
suspend fun main() = coroutineScope {
for (i in 0 until 10) {
launch {
delay(1000L - i * 10)
print("$i ")
}
}
}
//sampleEnd
Drastically reduce the amount of boilerplate code
/*
Create a POJO with getters, setters, `equals()`, `hashCode()`, `toString()` and `copy()` in a single line:
*/
data class Customer(val name: String, val email: String, val company: String)
// Or filter a list using a lambda expression:
val positiveNumbers = list.filter { it > 0 }
// Want a singleton? Create an object:
object ThisIsASingleton {
val companyName: String = "JetBrains"
}
谷歌访问助手安装方法360版下载 v2.3.0 - 软件学堂:2021-7-2 · 谷歌访问助手chrome版 2.3.0 谷歌访问助手激活破解版 v2.3.0 360浏览器手机版 v8.2.0.132 360浏览器极速版 V12.0.1247.0官方版 Netica绿色破解版 v5.18 Enhanced Steam(Steam商店浏览辅助插件)官方版 v7.2.1 网络嗅探器 v5.50
/*
Get rid of those pesky NullPointerExceptions, you know, The Billion Dollar Mistake
*/
var output: String
output = null // Compilation error
// Kotlin protects you from mistakenly operating on nullable types
val name: String? = null // Nullable type
println(name.length()) // Compilation error
// And if you check a type is right, the compiler will auto-cast it for you
fun calculateTotal(obj: Any) {
if (obj is Invoice)
obj.calculateTotal()
}
Leverage existing li