Comparison Kotlin to Java Programming Language

Kotlin fixes some of the Java issues.

  • Null references are controlled by the type system.

  • No raw types

  • Arrays in Kotlin are invariant

  • Kotlin has proper function types, as opposed to Java’s SAM-conversions

  • Use-site variance without wildcards

  • Kotlin does not have checked exceptions

Java has below that kotlin does not have

  • Checked exceptions

  • Primitive types that are not classes

  • Static members

  • Non-private fields

  • Wildcard-types

  • Ternary-operator a ? b : c

What Kotlin has that Java does not

  • Lambda expressions + Inline functions

  • Extension functions

  • Null-safety

  • Smart casts

  • String templates

  • Properties

  • Primary constructors

  • First-class delegation

  • Type inference for variable and property types

  • Singletons

  • Declaration-site variance & Type projections

  • Range expressions

  • Operator overloading

  • Companion objects

  • Data classes

  • Separate interfaces for read-only and mutable collections

  • Coroutines

Mansi Vaghela LinkedIn Twitter Github Youtube