The beginner’s dilemma: Should I learn Java or Python?

We often find ourselves with a decision to make whose impact is going to be long-lasting and is going to shape us in many ways. This is one of them.

First of all, remember, all languages are essentially the same, and all languages can more or less do the same thing in some way or the other. Choosing a language isn’t about it being easy or hard, it’s about how you see coding as a whole. If you’re happy coding, you’ll see it positively and won’t be afraid to try new things. However, a bad language can set you up for hating the construct of programming in general.

So coming to Java and Python, the difference between the two couldn't be more visible. Most people who are starting out with code get really impressed seeing python code for the first time, and for obvious reasons.

Here’s how printing “Hello World” looks like in Java:

Here’s the same in Python:

Right off the bat you can see the difference between them, Python conveys the steps in a more readable format, drawing a lot of interest because of it. But that’s not the complete story. Small code snippets are fine, but real world code needs to be taken into account. Java isn’t the world’s most widely used coding language for no reason.


Advantages of Java

  1. Java is verbose, readable and structured well. Larger amounts of code are much easier to read in Java.
  2. Java is widely used in a lot of platforms: Android apps (Mobile), Server backends, Desktop applications (Java FX), so learning Java is a stepping stone to any of these. (Note: 1) Earlier applets were written for browsers with Java but these are now considered obselete. 2) Android also allows Kotlin as a language but it is still a JVM based implementation.)
  3. A wide range of libraries and frameworks for adding new functionality to your app or program.

Advantages of Python

  1. Very simple syntax compared to a plethora of languages out there.
  2. Widely used in Machine Learning, Deep Learning and the general overarching AI field. Very useful in data analysis and visualisation.
  3. Used in Web development with frameworks like Django.

The Verdict

So the advantages are fine but what should you actually choose?

It depends. I’ll give a few pointers for you to choose:

If you’re just interested in programming and want to dip your feet in without going all the way, learn Python for its easier to learn syntax.

If you plan to pursue computer science/engineering, I would recommend Java first because it helps you understand the inner workings of programming as well. Doing python after Java would help you understand how it makes things easier.

If you plan on making mobile apps at any point, go for Java because Android needs Java and you can learn Swift rather easily after learning Java if you plan to go for iOS as well.

Make sure you go for the right resources while learning either of the two because that’s going to make the difference between you liking or disliking it.

Good luck.

“Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program.”
-Linus Torvalds
Like what you read? Give Deven Joshi a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.