What does Kotlin offers that Java doesn’t ? AND What does java offers that Kotlin doesn’t ?

What does java offers that Kotlin doesn’t

1.Checked exceptions - All exception classes in Kotlin are descendants of the class Throwable.
2.Primitive data types - Everything in Kotlin is an object .
3.Static members - Because, if you declare a companion object inside your class, you’ll be able to call it’s members with the same syntax as calling static methods/variables in Java.
4.Wildcard types - If you’re not familiar with it - In java you use bounded wildcards to increase API flexibility.

What does Kotlin offers that Java doesn’t

  1. Lambda expressions and Inline functions
  2. Extension functions
  3. Null Safety (No more annoying null exceptions)
  4. Smart casts (Yeah, typecasting is boring)
  5. String templates
  6. Properties
  7. Primary constructors
  8. First-Class delegation
  9. Singletons (many would argue, you could make singletons in Java, but that’s not officially supported).
  10. Range Expressions
  11. Operator Overloading (Good news for C++ developers)
  12. Companion objects
  13. Data classes
  14. Coroutines

And Kotlin is Simpler with engineering practicality than Scala.


There is a reason why Google has announced Kotlin as the official language for Android. If your focus is Android development, you should start learning it. It is worth the effort.

你可能感兴趣的:(What does Kotlin offers that Java doesn’t ? AND What does java offers that Kotlin doesn’t ?)