https://www.educba.com/java-vs-kotlin/
Key Differences Between Java vs Kotlin
Both Java vs Kotlin are popular choices in the market; let us discuss some of the major Differences Between Java vs Kotlin:
Kotlin has the support of smart cast which identifies immutable types and performs implicit cast by compiler whereas in Java we need to identify and perform the casting.
Kotlin has the support of type inference which means we don’t need to specify the data type of variable explicitly whereas in Java we need to specify explicitly.
In Kotlin, we don’t have checked exceptions, which is a disadvantage as it leads to error prone-code whereas Java has support for checked exceptions by which we can perform error handling.
Java compilation time is 15-20% faster than Kotlin compilation time but in perspective of incremental build compilation, Kotlin will also take same compilation time as Java.
In Kotlin, we can’t assign null values to variables or return values, if we really want to assign then we can declare a variable with special syntax whereas in Java we can assign null values but when we try to access objects pointing to null values raises an exception.
Kotlin is interchangeable with Java irrespective of difference between Java vs Kotlin. We can call Kotlin code in Java and Java code in Kotlin. So we can have both Java vs Kotlin classes side by side in a project and compiles without any issues. After compilation we unable to find which class written in Java or Kotlin.