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.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 12,168评论 0 10
  • 很多人白天上班8个小时都是坐着,没有时间去运动锻炼,肚子就这样长出来了,要怎样减肚子上的赘肉呀?其实坐着也能减肚子...
    遇见美丽sky阅读 1,382评论 0 0
  • 星期一/晴 十点钟的时候房东突然跟我说,你搬走吧!我:???? 房子还有五天到期,突然让我搬出去,我一头雾水。去问...
    酒久里个丸子阅读 1,261评论 0 0

友情链接更多精彩内容