Posts

Showing posts from December, 2020

Variables declaration in kotlin

  Var : It is used to declare mutable variable it means it can change the value of variable. Once we declare variable we can change the data of variable . Example: var a=1 In kotlin it is atomatically take datatypes   of the variable . Also, we can specify data type of variable Example: var a:Int =1 Val: It is used to declare Non mutable variable it means it can not change the value of variable. It is work as read only variable. It is same as final keyword in java. Example : Val myname=”kotlin” Lateinit: Iateinit means late initialization . you have to initialize the variable late . If you not initialize the variable than throws exceptions   . Example : lateinit var myname :String

Difference between kotlin and Java .

Kotlin: Kotlin supports Object-oriented and functional programming . There are no Null variables in kotlin . It doesn’t supports implicit conversation. Kotlin does not require to specify data types of variable . Kotlin do not require semicolons. Less chances to crash application. Java: Java supports only limited Object-oriented . Null variables and objects are parts of Java It supports implicit conversation. While java require specify data types of the variable. Java require semicolons. More chances to crash application.

Why Kotlin ?

It is faster than Java. It is Expressive and concise language it is supports to focus on expressing ideas. It provides safer code . because of it helps you to avoid Null pointer Exceptions. In kotlin included @Nullable and @NonNull in its type system. So application less crash . In kotlin code is clean. It is support more features than   java.

What is Kotlin ?

It is programming language   used to develop android application. Kotlin language developed by jet Brains. Kotlin is cross – platform , general purpose programming language . Android application works faster with kotlin. In world 60% of professional android developer used kotlin. Kotlin language helps boosts productivity, code safety supports less code more features . Kotlin is based on JAVA language and depends on the java class library . It use JVM to execute its byte code. Kotlin language is expressive language .