Member-only story
Python VS Java as your Starting Programming Language
So you’re planning to get started with programming, and are torn between choosing Python or Java. As someone who started with Python, but have worked with both languages (Java for work and Python for personal projects), here are some differences between the 2 as well as some pros and cons:
Why Choose Python
1) Python code is less complex to write than Java
Here’s how we print hello world in python (filename: hello.py):
print("hello world")
and here’s how we run Python (this goes into terminal or command prompt)
python hello.py
Conversely, this is how we print hello world in Java (filename: Hello.java)
public class Hello { public static void main(String[] args) {
System.out.println("hello world");
}}
Unlike Python, we need to first compile Java code before we can run it:
javac Hello.java
This will create a Hello.class file, and we can only run our program after compiling.
java Hello