Basic Different between Kotlin and Java
Kotlin: Kotlin was developed by JetBrains. Andrey Breslav was the team leader of Project Kotlin. The first version of Kotlin was released in 2016.
Java: Java was developed by Sun Microsystems which was later acquired by Oracle Corporation. James Gosling was the lead developer of Java. The first version of Java was released in 1995.
Code Size
Kotlin: In Kotlin we have to write 30-40% less code as compared to Java.
Java: In Java, we have to write more code as compared to Kotlin.
Null Safety
Kotlin: Kotlin does not have null pointer exception problem. Various ways are provided to deal with this exception.
Java: NullPointerException is the most common problem in Java that is occurred when we try to access a member having the null reference.
Checked Exception
Kotlin: Kotlin doesn’t have checked exception feature.
Java: Java has checked exception feature.
Operator Overloading
Kotlin: Kotlin allows operator overloading. The programmer can define the operators working according to need.
Java: Java doesn’t support operator overloading.
Use of Semicolon
Kotlin: It is optional to write semicolon at the end of statements.
Java: In Java, each statement must be terminated by the semicolon.
App Size
Kotlin: Android app built with Kotlin has more size because it contains Kotlin as well as Java libraries. Also, Gradle builds time slower for Kotlin as compared to Java.
Java: Android app built with Java has less size as compared to Kotlin. Gradle build time for Java is little faster as compared to Kotlin.
:) Happy Coding
[Collected + Self Research]