There are so many opinions all over the place on what is the best language to learn first.
Is it Python?
Or maybe Java?
To understand better how they compare, I read multiple articles from Quora.com on this topic and selected some opinions.
We start with opinions about Python.
I added the Quora articles links as well in case you want to read more.
Why is Python a good choice for the first language to learn?
Java is geared better towards applications, where as Python is geared better towards tasks.
Most programmers will eventually need C# or Java under their belt.
Python is generally a language for Sys Admins, mechanical engineers, and other adjacent career paths.
As a first language, Python is arguably easier.
Variables don't need a type, indentation is obligatory so you don't make block mistakes, syntax is very English-like, iteration is very easy, the standard library does a lot of things in very few lines of code, and so on.
Python’s syntax is much more simple and readable than that of Java.
It also does a much better job of minimizing the amount of code needed to complete a task, which is incredibly convenient for people learning to code as they don't have enormous walls of code to deal with.
Python has surpassed Java as the top language used to introduce U.S. students to programming and computer science, according to a recent survey posted by the Association for Computing Machinery (ACM).
Eight of the top 10 computer science departments now use Python to teach coding, as well as 27 of the top 39 schools, indicating that it is the most popular language for teaching introductory computer science courses
Python has been growing in popularity in the educational realm for at least the past few years, though this survey is the first to show it has eclipsed Java, which has been the dominant teaching language for the past decade.
Go for Python if you already have a background in computer science and want to apply that knowledge on quickly building something real, that be a web application or software tool.
Python is very quick and easy to learn, with tons of modules that do any kind of job for you, is less verbose than Java with a great community.
Why is Java a good choice for the first language to learn?
You can write VERY SIMPLE programs in Python faster than you can write programs of the same length in Java, so in that respect, you can learn Python faster.
For any serious program (longer than a few dozen lines of code), Java is much better because of various safeguards, such as static typing.
Since you spend less time debugging stupid errors in Java, you can spend more time learning the art of programming and software engineering.
To learn, as a first language, I think it's probably Python. I think if you compare a 'hello world' in each language, Python is obviously shorter, and it obviously makes more sense to a complete beginner.
When you get into beginner programs like 100, or 200 line programs, Python is probably still easier, because you're likely using built-in types, and it's obvious what the types and methods do.
When you get into intermediate size of programs, a few thousand lines, or maybe tens of thousands of lines, I think the advantage skews very strongly in favour of Java.
Dynamic typing makes your first few hundred lines of coding very easy, and your next ten thousand lines a complete nightmare.
Learning slows down, and mystery builds. Each object type you add, further increases the mystery (more class types to remember), whereas in Java, it makes things clearer as there is a total rigidity in what everything is.
For learning, I think if you want your first week to be easy, learn Python, if you want your first 6 months to be easy, learn Java.
I've used Python for longer than I've used Java, I've probably written more Python code than I've written Java code.
I was using Python almost before Java was even released, but I strongly (very strongly) prefer Java. Java is just incredibly strict by comparison, and strict means simple, it means not vague, not flexible, not forgiving.
Unforgiving is good, it provides structure and predictability. A forgiving language means it's vague, fragile, and prone to run time errors, which would (and should) be caught at compile time.
If you've never programmed before, I'd generally recommend Java as a first language.
Python is a great language, but in its attempt to make things easier, I think it actually makes some things harder for a new programmer. Python hides too much and that makes things confusing for a new programmer.
Python hides this stuff. It all looks like magic.
In Java, it's more explicit what the types of variables are.
There's much less "magic" that happens.
Unfortunately, if you're relatively new to programming, I'd have to say - Java.
I say unfortunately because I really, really, really don't like Java.
Many people will disagree, but, again, some people like washing dishes, too.
The freedom and dynamism that characterize Python are beautiful and powerful things, but they must be earned.
If you start with Python, many a thing will be a mystery and you'll start thinking that all computers work that way.
Well, they don't.
It's pretty much quite the opposite.
So, if you already know how computers work, you'll understand what's going on and know how to appreciate it.
If you don't, what will probably happen is that you'll lay out your foundations of your programming knowledge wrong and then you're screwed. You'll struggle to find sense in anything.
Go for Java If you are a total beginner and have never learned computer science before.
This may sounds like the opposite of what you've heard, but do it.
Java will always force you to go down to the understanding of how things really work , instead of Python which tend to hide some technical details in order to make things simpler.
My recommendation would be to learn Java first for many of the reasons others have listed.
I assume that you have no previous programming experience for the sake of my answer.
Learning Java will force you to learn to think a little more like a programmer as you learn it.
Python is a little oversimplified and while that may seem like the ‘easy’ route, I think it will gain you some false self-confidence.
Your appreciation for the simplicity of Python can really only be achieved by learning a language like Java first.
Something else to consider is the amount of jobs available to Java developers. Java is pretty much an industry standard for A LOT of applications.
I think the amount of opportunities out there will be far greater for you by learning Java first. Python will come much easier to you after you know Java and it will be a nice add-on to your resume.
The final decision is yours.
Interested in a Java-vs-Python summary spreadsheet?