-
Notifications
You must be signed in to change notification settings - Fork 2
Basics
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
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"
}
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}")