Skip to content
Siddhant edited this page Dec 6, 2017 · 6 revisions

Kotlin

Kotlin is a statically-typed programming language that runs on the Java virtual machine and also can be compiled to JavaScript source code or use the LLVM compiler infrastructure. Its primary development is from a team of JetBrains programmers

Difference between var and val

var is variable, you can reassign value. val is constant, once value is assigned it can not be changed like final in java For example
var name:String=null
val batch:String=null // can not change once assigned
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
name="Siddhant"
}

String Concatinate

now we can use string concatination with different way also
var name="Siddhant"
println("My name is $name")

for object - we can't directly print student.name value,it gives hash value of student
var student=Student()
println("my name is ${student.name}")

Clone this wiki locally