Which of them is better between Java vs Python And why

+6 votes
For the sake of young millennials and freshers planning between these two platforms, I'm creating this thread for discussion. I'm not a developer myself, so the opinion of you techie folks is apt on which is better between Java vs Python. Plz justify your take based on parameters like job openings, career growth, prog lang efficiency, etc..
Oct 16, 2018 in Career Counselling by Vardhan
• 13,150 points
6,333 views

There's a  video  that talks about the very same topic with an example that justifies the debate. Have a look for better understanding.

Mainly The Syntax but Java is also a more complicated language than python.

28 answers to this question.

+3 votes
Python! Looks better, works better, is better!
answered Oct 16, 2018 by Pyrate
Justification mate! How exactly and what exactly?
Okay. Justification: Python code looks better than, Python code works better than Java. Hence, Python is better than Java.
The grass is always greener on the otherside.

Maybe you need to also look at Java once and understand how Java works...
How can you say python is better in looks?

Java:

public class HelloWorld{public static void main(String[] args){System.out.println("Hello  World");}}

Python: 

print "Hello World"

It looks simple and gets your job. Not too much of mess in Python

Yup, Python is definitly better

Hi, @Aarohan,

Register/Sign up on the community to gain points for further contributions. You may ask questions, answer, upvote, and downvote an answer. Each of these would fetch you points and you could be among the top contributors and win exciting merchandise from Edureka. 
Thanks, @Aarohan for your contribution.

+1 vote
Statically typed
In Java, all variable names (along with their types) must be explicitly declared. Attempting to assign an object of the wrong type to a variable name triggers a type exception.That’s what it means to say that Java is a statically typed language.

Java container objects (e.g. Vector and ArrayList) hold objects of the generic type Object, but cannot hold primitives such as int. To store an int in a Vector, you must first convert the int to an Integer. When you retrieve an object from a container, it doesn’t remember its type, and must be explicitly cast to the desired type.

Dynamically typed
In Python, you never declare anything. An assignment statement binds a name to an object, and the object can be of any type. If a name is assigned to an object of one type, it may later be assigned to an object of a different type. That’s what it means to say that Python is a dynamically typed language.

Python container objects (e.g. lists and dictionaries) can hold objects of any type, including numbers and lists. When you retrieve an object from a container, it remembers its type, so no casting is required.
answered Oct 16, 2018 by Priyaj
• 58,020 points
Bruh.. I dont understand a thing
Bruh if you are not understanding then its time you start with python as this language is used in Java and not in python
+3 votes
Java is more like bounded by keywords i.e strictly typed

Python is more like user friendly language
answered Oct 16, 2018 by blahblah
+3 votes

Java is a general-purpose programming language while python web development is a high-level programing language delivering better code readability with shorter syntax.

answered Oct 16, 2018 by Rachel Ryan
+3 votes

Java or Python, biggest debate ever, but honestly it totally depends on your requirements. In the fields of data analytics, data science, etc. uses python or R and not java. Lets remember one thing, these job description are once that are hot in market, when I say hot, they have higher demand in most of the companies-big or small. Moreover Pyhton is easy to understand and use, compared to java.
One of the major drawback of python is parsing the whitespaces which puts people off python. I would definitely prefer python.

answered Oct 16, 2018 by Kalgi
• 52,350 points
+3 votes
Java has longer lines of codes for simple work!

Python keeps it simple with less number of lines giving an advantage of better readability
answered Oct 16, 2018 by Popython
+1 vote

Hey, I have been working on python for sometime now and I have worked on Java a little.In the beginning, I started coding with Java for practice and to build simple projects but once I switched to python, I have never wanted to go back to using Java again. For me, python is easier, simpler and more comfortable than Java. One might argue that Java is faster than python or mention few other advantages of Java over python. But according to me, Python is better. Here are some features of Python that i like:

  • Ease of Use: Python is simple to code. You do not have to add semi-colons “;” or curly-braces “{}” anywhere. This makes it less messy and easy to use.
  • Large Collection of Libraries: Python has a huge Collection of libraries which provides methods and services for various purposes.
  • Dynamically typed: In Python, you don’t have to define datatypes for variables, you can directly use the variables wherever required. 
  • Easily Understandable Syntax: Python syntax is easily understandable mainly because reading a Python code is very similar to reading a statement in English. It is expressive and easily readable, and the indentation used in Python also helps the user to differentiate between different scope/blocks in the code.
  • Small code, large task: In Python, you can write small codes to do large tasks. 
  • Community: Python community has one of the biggest and most active community so its helpful if you get stuck while writing the code.
answered Oct 16, 2018 by Omkar
• 69,220 points
But, but....JAVA is evergreen. There are legacy systems that cannot run on anything other than Java :)
+2 votes
Your possibility of getting a job in Java is more but Probability of getting jobs after learning Python stays on top as it is related to automation and machine learning and the industry is turning more towards Automation and Machine Learning.
answered Oct 16, 2018 by deep_dive
+2 votes
Machine learning is the new big thing right and it's going to grow. Which language is used there? java or python? Obviosly python.

Better to got for a language whose being used in a evolving technology.
answered Oct 16, 2018 by Krishti
+3 votes
Its tough to say really.. Python has been growing steeply offlate. But the issue is, it came a little too late into the market...

Yes, Python is easier to code in. Yes, Python can be used for anaytics. Yes, Python is used for shell scripting...But you cannot take away the fact that Java is a more dynamic option. Its not best suited for every domain....like the gaming industry for instance...

Games even today are written on C#. And the one'e who know Java can easily jump off their prog lang dependency.
answered Oct 16, 2018 by chaitanya_narala
• 970 points
0 votes
I'm sure you guys would have learnt java in college, better go for a new language, learn python.  And also java is known by a larger population when compared to python, you might as well stand out. I would suggest for python.
answered Oct 16, 2018 by Haider
+1 vote
Let's look at "Which is better?" from a career point of view. Java has more job openings compared to Python but when it comes to salary, Python will get you paid more than Java will. Domains like Machine Learning, Robotics, etc. use Python over Java. So Python has its uses in a larger set of domains compared to Java. So, if you are still in the years of starting your career, I'd suggest you go with python. Even if you have been working on Java, it's never too late to switch to python
answered Oct 17, 2018 by Dinesh
+1 vote
The phrase “dynamically typed” means that Python performs type checking at runtime, while statically typed languages like Java perform type checking at compile time. Python can compile even if they contain errors that would prevent the script from running properly. On the other hand, when Java contains errors, it will not compile until the errors have been fixed.

Java also requires you to declare the data types of your variables before using them, while Python does not. Because it is statically typed, it expects its variables to be declared before they can be assigned values. Python is more flexible and can save you time and space when running scripts. However, it can cause you issues at runtime.

Choosing a language boils down to what you’re trying to achieve with your code. Performance is not of the essence in software at all times, but it is always worth keeping in mind. Java is more efficient when it comes to performance speed thanks to its optimizations and virtual machine execution.

You can add Python implementations without this restriction, but they can negatively affect portability assumptions within the Python code. Therefore, when it comes to sheer speed performance, Java has the edge.

However, Python is more effective when it comes to adapting legacy systems. The language is more suited to make changes to an existing legacy system. Python can make gradual shifts instead of fully rewriting and revamping the system like Java does.

Java in the enterprise world is a more verbose coding style, which means that these systems are often larger and more numerous than Python legacy. The latter language is more common among enterprise code that glues their IT infrastructure together, making it more effective in adapting legacy systems.

As far as practical agility goes, both languages have their pros and cons. Recent advancements in DevOps have benefited both as Java thrives on more consistent refactoring support. This is due to the language’s static type system, which makes automated refactored more predictable and reliable.

Meanwhile, Python’s dynamic system relies on brevity, fluidity, and experimentation in code, giving it more versatility than Java’s rigid style. Python has also been adapting to automated testing in modern development, but this happens more frequently in integration instead of unit testing.

Choosing which language to goes with depends on your company’s needs, and which setbacks you’re willing to accept. While Java churns out higher performance speed, Python is more suited to evolve legacy systems. When it comes to practical agility, Java is a more proven option, while Python has more flexibility for experimentation.

Java is still king in the coding space as it remains the most popular language. It has traditionally been the language to teach beginners, but this is quickly changing as Python is gaining steam. A recent survey from the Association for Computing Machinery (ACM) found that Python has surpassed Java as the most popular language to introduce students to programming.

The survey found that eight of the top 10 computer science departments in the U.S. now use Python to teach coding, as well as 27 of the top 39 schools. Python’s becoming more popular in the academic world for only three or four years as it is being taught as early as high school and through college.

There are several reasons for this shift, including that Python is a general-purpose language, which means that it can be used to build almost anything. The language is great for backend web development, data analysis, artificial intelligence and scientific computing. In addition to its professional uses, it can also be used to create games, productivity tools, and desktop apps.

Since its inception, Python was created so it would be easy to understand and easy to use as the name came from Monty Python. It is more beginner-friendly because it reads like English, making it a more intuitive learning experience from a syntactical standpoint. The language takes a load off coders by taking care of a lot of the language’s complexity.

Plus, Python is very flexible because it is dynamically typed. While Java has hard rules on how to build features, Python offers different methods to solve the same problem. The language is also more forgiving of errors, allowing you to compile and run your program easily.

One major downside for beginners is that Python can be difficult to maintain as errors are hard to track down and fix. The rigid nature of Java ensures that you fix every problem in real time, saving you time fixing code later down the line. Python is also slower because of how flexible it is, slowing its performance down, making Java more attractive in that sense.

While Java certainly has its benefits and it can do wonders for experienced coders, Python makes the most sense for beginners. It is more flexible, has a more intuitive user interface and it creates a more enjoyable coding experience.
answered Oct 17, 2018 by SDeb
• 13,300 points
+1 vote
If you ask me to choose between java and python. I will go with Python anytime!
answered Oct 31, 2018 by Myra
• 300 points
@Myra There are times when Java serves the purpose better.

Not all the time you can choose Python.
What I wanted to say all the time means there would be tons of opportunities in Machine learning, automation, AI.

AI is the next big thing and if you want to jump into it you must know python.

So, why to go with java in 2019???
@Myra agreed but still there are many application that still works on Java and changing the entire architecture won't be possible. So I will still say that both are good but in their own domain.
Hey @tyler.. Can you give some example of when Java serves the purpose better than Python?
@Myra, I agree. Java and Python can be used for many purposes but there are domains like Machine learning and AI where Python is preferred more than Java
Well, I think you should also explain why. Why would you choose Python over Java?
@Myra, I agree to it. Now a day working with python is way more easier than working on Python.

Python according to me is a better way of programming where you just need to be worried about the content and no hectic Parentheses.

The library offered by python is huge.

There are many other things that makes python better than java.
0 votes
I would choose the language according to the work am into:

JAVA - if i need to build fairly large projects which involves heavy logic, preferably using spring framework.

Python - All tools, scheduled jobs, exposing small REST APIs using Flask, I would prefer Python.

Anyways both have equal hold and choosing one totally depends on the work you need to accomplish.
answered Oct 31, 2018 by tyler
0 votes

If you haven't learned either of them, then going for Java is a better option. Makes more sense as python can be applied in multiple places and is most suitable for use with the new trending technologies like machine learning and AI and data analytics. 

answered Jan 17, 2019 by Kiara
0 votes
Performance wise Java is better than Python
Also using python you cannot develop mobile application however using java you can develop mobile application
answered Jan 24, 2019 by anonymous
+2 votes
both are good java is more use in developing web application and it is more secure .but python is more used in machine learning and data science so do not compare each other both are good
answered Feb 1, 2019 by rajesh
• 1,270 points
+1 vote
both are good java is more use in developing web application and it is more secure .but python is more used in machine learning and data science so do not compare each other both are good
answered Feb 1, 2019 by rajesh
• 1,270 points
+3 votes

Python.

Don’t even think about it to select another language as your first. Why? Well,

  • Python is easy. Trust me on this one. My first major language was C++ and it lead me to contemplating a career change. Here’s a short snipped of C++ code for displaying “Hello world” on the screen 

  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. cout << "Hello world!" << endl;
  6. return 0;
  7. }

Here’s the same thing in Python

  1. print("Hello world!")
  • Now both Python and Java support OOP (object oriented programming) but Java forces it upon you by giving you no other way out. That, for big companies and large scale projects, might be a good thing but for someone who doesn’t even know what a class is can be a big hassle. Python, on the other hand, lets you do your own thing. Again, this might be a bad thing but it’ll all depend on the kind of practices you pick up and follow. Ruby is another language and it is very similar to Python but I don’t like it as much because it’s way more lenient on coders. Python kind of maintains that fine line. But yes, for a beginner, Object Oriented might feel forced if all you need to do is write something to take in two numbers and print their sum but in the long, really long run, it could be a good thing.
  • Python is used almost everywhere. Web development? Check. Penetration testing? Check. Making awesome games? Check. Glue code for projects not native-ly written in Python? Check. Maching Learning? Double check that boy! Scientific research? Check. Academics? Check. Android apps and other scale-able projects…? Java is your thing. Native programming is one place where Python fails.

And I think that’s about it. Both languages are great in their own thing and what they’re used for but Python, hands down, is one of the best things a beginner could start with today.

answered Feb 1, 2019 by navdeep
• 240 points
0 votes
java and python both are good.java is more used in web application and also secure

python is more used in machine learning and artificial intelligence.use can easy learn python and machine learning
answered Feb 6, 2019 by rajesh
• 1,270 points
My favorite book to learn Python is "Learn Python the hard way". Have you read it?
0 votes
python beat java because python are more used in machine learning and artificial intelligence.and also used for web application
answered Feb 13, 2019 by rajesh
• 1,270 points
That's my exact same justification on why python is better.
0 votes
both language are better in different different field .java is more used in developing wed application and it is more secure as compare python. and python is more used in machine learning and artificial intelligence
answered Feb 15, 2019 by rajesh
• 1,270 points
0 votes
Python is a programming language that flaunts a gentler expectation to absorb information, and an increasingly instinctive coding style. Java is likewise another programming language, however with a particular preferred standpoint contrasted with other programming dialects. Projects made with Java can be kept running on any working framework that can run the Java virtual machine. This is on the grounds that Java does not order to local bytecode, similar to Python does.
answered Mar 12, 2019 by Letsleads
• 140 points
0 votes
I'd chose python anyday over java.
answered Mar 14, 2019 by Shalini
0 votes

Hello

Both of the Programming Language are very much essential and has its own merits and demerits . It would be best if one could gain the knowledge of both the Programming Language. When the time comes where you can choose only one language to start your Career then i suggest you to go with Python .I choose Python because it is very much user friendly , easy syntax, most used Programming language at present and It is expected to have a great Scope in the future.  Python has more number of libraries compared to Java. If you Pursue Course for Python then you have the opportunity of working on Data Science Projects which is the trend of today. At present big company like Facebook , Instagram, yahoo and many more uses Python .

Example with the help of program to show why i feel Python is better than Java

Java program to print hello

 class A {
 public static void main(String args[]){
     System.out.println("Hello World");
 }
}
Python program to give output Hello

# This program prints Hello, world!

print('Hello, world!')

We can see the difference in the level of difficulty in term of Programming.


answered Mar 14, 2019 by MrBoot
• 1,230 points
0 votes

Python is more productive language than Java. Python is an interpreted language with elegant syntax and makes it a very good option for scripting and rapid application development in many areas. ... Python code is much shorter, even though some Java “class shell” is not listed.

answered Nov 22, 2019 by Koenig
• 140 points
But isn't java faster?
I think that python is better for programming as it is very easy to use and the syntax's are very easy to remember like the print function which is used like print ('hello world')
0 votes
Java may be a more popular option, but Python is widely used. People from outside the development industry have also used Python for various organizational purposes. Similarly, Java is comparatively faster, but Python is better for lengthy programs.

Eventually, it depends upon the type of program a developer wants to create. If you consider the above parameters, and a language ticks most of your boxes, it is safe to go ahead with it. However, if you are beginning to foray into development, Python might be a better choice. On the other hand, Java will be the preferred option for enterprise-level programs.
answered Aug 21, 2020 by Pistle
• 1,000 points

Related Questions In Career Counselling

0 votes
2 answers

Differences between Nosql and sql? Which is better to learn?

Hey, SQL databases are primarily called Relational Databases (RDBMS); ...READ MORE

answered Jun 10, 2019 in Career Counselling by Gitika
• 65,770 points
958 views
0 votes
1 answer

What is the difference between Python and Jython?

Hey Dheeraj, following are the differences between ...READ MORE

answered May 10, 2019 in Career Counselling by Anvi
• 14,150 points
3,012 views
+2 votes
2 answers
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,460 views
0 votes
1 answer
+3 votes
4 answers

Why is cloud better than on-premise?

The major 5 benefits I see for ...READ MORE

answered Nov 2, 2018 in Career Counselling by Priyaj
• 58,020 points
1,120 views
+1 vote
3 answers

Why is it important for the software testing team to interact and discuss with the development team?

They allow the developers to get valuable ...READ MORE

answered Jul 30, 2019 in Career Counselling by anonymous
933 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP