Kotlin is like java
var myVariable = 42
myVariable = 50
val myConstant = 42
val age = 42
if (age < 10) {
println("You're too young to watch this movie")
} else if (age < 13) {
println("You can watch this movie with a parent")
} else {
println("You can watch this movie")
}const val SYSTEM_DEPRECATED: String = "System is deprecated"val explicitDouble: Double = 70.0
println("Hello, world!")
// if is an expression, so ternary operation not needed
val loaded = true
val status = if (loaded) "Ready" else "Loading..."
// "Readyval apples = 3
val oranges = 5
val fruitSummary = "I have ${apples + oranges} " +
"pieces of fruit."
val label = "The width is "
val width = 94
val widthLabel = label + width
// The width is 94
Also in Java:
- how to skip a line in java
- How can I put a parameter into a localized string in Android?
- jackson ignore values if empty
- how to create a circle in java
- how take inputs in java with message
- how to set a variable java
- web app runtime for java
- java create folder
- java function without return
- vertical traversal of binary tree
- java polymorphism
- Java.awt graphics tutorial
- Linked List implementation
- isnumber java
- floor in java
- print in one line in java
- crit chance in java
- java iterate over list
- countdown timer with seekbar
- how to pass parameters to xsl file
- java stack
- recursion in java
- java output length of each line in a text document
- bukkit java set leather armor color from hex