天天看點

Can I learn basic Java before Kotlin, or is that not necessary? If I learn Java will it be helpful for Kotlin?

Chanaka Fernando, knows Sinhala

Answered Tue

You don’t need Java knowledge to learn Kotlin or Kotlin knowledge to learn Java. Having said that, If you know Java, that will be helpful when you need to interop with some Java libraries. You can start learning any of Java or Kotlin without prior knowledge of the other.

Ankit Singh, Technology Enthusiast, Blogger

Kotlin resembles most of the construct as of Java. Having knowledge of Java atleast basics of it will help you in learning Kotlin.

If you start learning Kotlin directly it will take time to understand the language. As it uses various APIs that are in Java.

I would recommend you to go through basics of Java, before starting Kotlin. You don’t have to master Java.

Alexey Soshin, System Architect at Gett (2015-present)

If you learn Java, it will help understand how Kotlin works better.

But it’s not mandatory to learn Java before Kotlin.

Kotlin is more modern and more pragmatic language. It simplifies a lot of stuff:

less boilerplate

null safety

type inference

generics

Ed Guenther, Using Java throughout my career; basically since the day Java 1.0 was released.

Keep in mind that both languages run on the Java Virtual Machine. So a good amount of JVM related knowledge is a good thing to have.

Then Kotlin is designed to be fully inoperable with Java - so it also makes sense to know a bit about the Java language. And it often helps to look at some construct B in one language - to then think “hmm, in that other language, I would write that as B*”.

And finally: the true power of programming in Java is the plethora of standard and 3rd party libraries that you have access to. Having a bit of “overview” understand around that is important, too.

So, long story short: it definitely helps. Maybe not necessary, but (imho): very close to necessary.