DEV Community

javinpaul
javinpaul

Posted on • Updated on

Kotlin or Java? Which is Best Programming Language for Android Developers?

Disclosure: This post includes affiliate links; I may receive compensation if you purchase products or services from the different links provided in this article.

best Kotlin courses

Ever since Google announced @Kotlin as the official language for Android development at Google IO in 2017, programmers who want to become Android developers are in a dilemma.

The big question in front of them is whether they should learn Kotlin or Java.

If you are a complete beginner who wants to learn Android development, then my answer is Java, but if you are a Java developer who wants to jump into the lucrative market of Android app development, then my answer is Kotlin.

I’ll discuss why beginner Android programmers should start with Java and why Java developers should learn Kotlin in this article.

When I say beginners should start with Java, you may be thinking, “What the heck? Kotlin is much more productive, less boilerplate code, and now the official language of Android development, and this guy is suggesting learning Java. I am not gonna fall for it…”

Well, being a Java developer, I may be a little bit biased, but I’ll try to explain the reasons why I suggest a beginner Android developer starting with Java rather than Kotlin.


Kotlin or Java? Which is better for Android Developers?

The first and foremost thing is that Android development is not everything; as a programmer, you may be starting your career with Android development, but if you start with a well-established language like Java, you become a part of the bigger Java community and market, which directly means more job opportunities.

The second and more important thing is that there is a huge community of Java programmers, which means you can find answers when you are stuck.

This is very important because, as a beginner, you will face a lot of technical problems and you might not know where to head when you are stuck.

When you search Google with a Java problem, you are bound to get answers; the same cannot be said for Kotlin, which is still a new programming language.

There are also more tutorials, books, and courses out there, both free and paid, which can teach you Android development with Java, like this list of Android resources for Java programmers, but there are not many for Kotlin, especially free resources on Android development.

Things will definitely improve over time when more and more programmers start using Kotlin, but I doubt it can ever touch the popularity and adoption of the Java programming language.

That’s why I suggest, a beginner programmer who wants to become an Android developer should start with Java, rather than Kotlin.

However, that’s not a hard and fast rule; if you prefer learning Kotlin rather than Java due to productivity reasons and are mostly focused on Android development, then you can sure start with Kotlin, and Kotlin Fundamentals is a good place to begin.

But, once you know Java, your journey to Kotlin will also be easy and smooth because Kotlin is 100% interoperable with Java. It compiles into Java bytecode and runs on JVM.


Java Programmers Should Learn Kotlin

Now, coming back to the second set of programmers who wants to learn Android development: our fellow Java developers. For them, I think it's best to learn Kotlin because it really improves productivity.

A class that takes 50 lines of code in Java can really be written in just one line in Kotlin. It can help you avoid all boilerplate code, like you don’t need to specify getters and setters, equals(), hashCode()or toString() methods. Kotlin can generate all that by itself.

Here is a nice comparison between Kotlin and Java in terms of productivity and lines of code to write similar stuff:

If you don’t know, Kotlin was developed by JetBrains, the company behind one of the most popular Java IDEs, IntelliJ IDEA. They were a Java shop and developing IDEs like IntelliJ IDEA, PyCharm, and ReSharper, all in Java, and built Kotlin to improve their productivity, but at the same time, they cannot rewrite all their code in Kotlin, so that’s why they made Kotlin fully interoperable with Java.

Because Kotlin generates Java bytecode, you can use your favorite Java frameworks and libraries in Kotlin and your Java friends can also use any Kotlin framework you develop.

Even a major Java framework like Spring has started supporting Kotlin from Spring 5. If you don’t what’s new in Spring 5, check that out.

Even though currently, almost all @android code, examples, and apps are in Java, it will change in the future because Google has declared Kotlin as the official language for Android app development.

Many companies have already started using Kotlin for their Android app development, and that’s the main reason I think Java developers should learn Kotlin.

If you decide to learn Kotlin Programming language, then Kotlin for Android: Beginner to Advanced is also a great place, to begin with. It’s a no-nonsense course for Java developers which will help you to get going with Kotlin in no time.

You don’t need to start with things like what a variable and object are, as this course has the right pace and depth for Java developers as compared to other beginner Kotlin courses for Android development.

If you prefer books, then Kotlin in Action is also not bad. You can learn about all the essential features of Kotlin, e.g. var vs val, data keyword, and functional programming all by yourself.

That’s all about whether Android developers should learn Kotlin or Java. As I said, if you are a complete beginner who wants to start your career as an Android developer, you’d better start with Java.

You will not only get up to speed in no time, but you would have better community support, and knowledge of Java will help you a lot in the future. It will also help you to learn Kotlin in the future.

If you are a Java developer, then you’d better start learning Kotlin to not only improve your productivity but also help you become part of a lucrative niche of Java developers who know Kotlin, which may give you a competitive edge in the job market. It’s also one of the 3 JVM languages Java developer should learn on my list.

Other  Programming Courses and Articles you may like

Thanks for reading this article so far. If you liked it then, please share them with your friends and colleagues. If you have any questions or feedback, then please drop a note.

P. S. - If you want to learn a valuable skill like Kotlin, then I highly recommend you check out these best Kotlin courses from Udemy, which are both comprehensive and very engaging. You can use this course to learn Kotlin for server-side Java development and mobile app development with the Android platform.

Top comments (8)

Collapse
 
terabytetiger profile image
Tyler V. (he/him)

What are your thoughts on starting with Flutter/Dart instead of Java or Kotlin (assuming you aren't locked into learning one or the other for a job)?

I'm not versed that well in any of the languages or their trade-offs (outside of this article), but it almost seems like Google is pushing Flutter over Kotlin because of the flexibility to write once and create the iOS and Android Apps.

Collapse
 
tux0r profile image
tux0r

Dart is not officially supported via Android Studio yet as far as I'm aware...?

Collapse
 
terabytetiger profile image
Tyler V. (he/him)

While it isn't officially supported yet, it is in the final preview before v 1.0 release and does integrate with Android Studio via the Flutter & Dart plugins.

Thread Thread
 
tux0r profile image
tux0r

Oh, I did not know that. Thank you.

Collapse
 
ranlohith profile image
Sid Lohith

Nice article. Thanks for sharing.
flowerbrackets.com/difference-betw...

Collapse
 
tux0r profile image
tux0r

I'd vote for Delphi, to be honest.

If you absolutely need to decide between the two Android Studio languages, Kotlin is a safe bet - much less annoying to use than Java.

Collapse
 
javinpaul profile image
javinpaul

I think Java is still better when it comes to reach like jobs, support, and community.

Collapse
 
tux0r profile image
tux0r
  • Jobs: If that's what you're after, you should leave mobile development and try COBOL. It will make you rich very soon - and it will be a safe lifetime job.
  • Support/Community: Kotlin is a first-class citizen on Android. The developer documentation perfectly covers Kotlin.