If we can convert both Java & Kotlin into each other then what is a use of learning Kotlin ? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

If we can convert both Java & Kotlin into each other then what is a use of learning Kotlin ?

4th Dec 2019, 7:26 PM
kev_coding
kev_coding - avatar
8 ответов
+ 6
Kotlin is less frustrating than Java. Also no NullPointerExceptions because Kotlin doesn't have nullable types and any null will fail at compile time :) Another point is checked exceptions. It's a matter of preference, but Java tends to get cluttered with try/catch blocks, while in Kotlin there are no checked exceptions. Whether this is good or not and enforces better coding style/error handling is up for you to decide. It's a matter of preference I guess. You can use delegates in Kotlin kinda similar to what you see in C#. It all comes down to preference and taste. The fact that they are 100% interchangable even allows you to use BOTH at the same time, what's stopping you? Java might be a good basis to learn but is a bit of a dinosaur (but not like COBOL yet) and Kotlin is the shiny newer style with some more syntactic sugar on top. Love it or hate it.
4th Dec 2019, 8:08 PM
Brendon Bosman
Brendon Bosman - avatar
+ 9
• A Few Thoughts About Kotlin and Why I Like It So Much — https://dzone.com/articles/few-thoughts-about-kotlin-and-why-i-like-it-so-muc?fromrel=true
4th Dec 2019, 8:47 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 6
The last time I converted between them I spent 30 minutes fixing errors. It was for over 2K lines of code so faster than recoding from scratch, but I needed to understand both languages to correctly fix things.
5th Dec 2019, 12:34 AM
John Wells
John Wells - avatar
+ 4
Brendon Bosman there are null pointer exceptions whenever you use: !!, if the value is null so: readLine()!! generates an exception on end of file.
5th Dec 2019, 12:48 AM
John Wells
John Wells - avatar
+ 3
I read that with kotlin you can write a code in much less lines than with Java ,
4th Dec 2019, 8:11 PM
Abhay
Abhay - avatar
+ 1
John Wells I didn't know that, that's pretty funny, thanks for sharing!
16th Dec 2019, 5:11 PM
Brendon Bosman
Brendon Bosman - avatar
0
How we can do that?
4th Dec 2019, 7:47 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
- 3
Bonjour
11th Dec 2019, 9:13 PM
Coly Moussa