Question:
Is it necessary to learn Java before going on to Python?
Androidface
2009-12-16 01:10:16 UTC
I have done C and C++ is it necessary to learn Java before switching to Python?
Six answers:
anonymous
2009-12-16 08:08:14 UTC
I've taught both Java and Python (as well as a lot of other languages) as first languages (and I've written books about both languages.) Either will do fine. Currently we teach Java as our first language for CS majors, and I'm working on changing to Python in the first course with Java and C in the second.



Java is a good teaching language, but it has a lot of rules. It makes you do things the 'java' way, which is sometimes verbose, but often good style. For example, here's a simple 'hello world' in Java (ask user's name and return it:



import java.util.*;

public class HelloWorld {

..public static void main(String[] args){

....Scanner input = new Scanner(System.in);

....System.out.println("What is your name?");

....String userName = input.nextLine();

....System.out.println("Hi there, " + userName + "!");

..} // end main

} // end class def



It's not that difficult, but you must do everything correctly. Java insists that every program is an object (even in this case where OOP buys you nothing) It also requires you to build the main function in a way that supports command-line arguments (even though we ignore them here). You must explicitly create an object for reading input from the command line (believe it or not, this is the easy way. It used to be much messier.) Note I changed indentation from spaces to periods because YA ignores spaces.



Now take a look at exactly the same program in Python:



userName = raw_input("What is your name?")

print "Hi, %s!" % userName



Python tends to be a lot easier to follow. For beginners, the main issue is understanding how programming works; what are variables, conditions, loops, branches, and functions. Java syntax tends to be more correct, but Python doesn't get in the way of the big idea as much.



If you only learn Python, you tend to get sloppy. If you only learn Java, you might get frustrated and think programming is harder than it really is.



Since you already know C and C++, you'll be fine with either language. I think you'll really enjoy Python, and you'll find yourself building more sophisticated programs with it more quickly than with other languages. You might find Java more frustrating at first, but once you get past the initial shock, you'll find that Java is an incredibly powerful language that can do pretty much anything. Java currently has a lot more potential for employment, but Python is really beginning to catch up, especially in web development, gaming, and bioinformatics.



As to some of the other answers:

Python has built-in support for the TK GUI system (in most installations) This is a perfectly fine easy GUI system. If you want something more substantial, you can access many other GUI libraries, including WXWidgets or GTK. These do pretty much everything Swing does (Java's most advanced GUI toolkit.)



Both languages are based on C, but in very different ways. Java still retains some C-like syntax, but that's a pretty superficial resemblance. The internals of Java and C are very different, and the way you program in Java is very different than C. Python's syntax is very much unlike C (no semicolons or braces, indentation is used to define blocks) but the thinking style of Python is actually closer to C than it is to Java. (You can use procedural or object-oriented programming, code tends to be linear, there's a lot of freedom, and c-based libraries are easily integrated into Python)



I hope this helps. Stop by my web site to see code samples or ask any other questions...
Melinda
2016-04-10 08:32:58 UTC
No, JAVA is not actually needed at all. Recommendations (in this order) 1. HTML is a requirement if you're learning PHP for web use. 2. Blend Java SCRIPT in with your PHP learning. PHP is all executed on the SERVER while Javascript is executed on the user's browser. There are some things PHP simply can't do because of this (and vice versa.) 3. AVOID software foundations (Zend, etc.) at the start if you truly want to know what you're doing. If you learn from scratch and rely on foundations, you'll be lost when you can not use them in a given project. Hope this helps! PS: No third party software is REQUIRED to utilize HTML, JS (javascript) or PHP, however you may eventually want to invest in an IDE (Integrated Development/Desktop Environment) just to make things easier to organize and transfer.
deonejuan
2009-12-16 01:21:09 UTC
Python is so cryptic, so terse, that I run back to java's verbrose, descriptive method names every time. Java is more of the style of template coding. Python code can be done several ways. But, the main strength of Java is: java code can install the plug-in and go, futhermore, java comes with the widgets right out of the box. Python needs an install and python needs your selection choice of which widget library to use.



So, you might as well start with Python.
?
2009-12-16 04:40:27 UTC
I have experience with c/c++/Java/python and really I think python is more similar to c or c++ than java. But either way they are all just c derivatives so once you know any of those languages learning another one is easy. Short answer is: no, if you know c/c++ pythin will be no problem. Just code something simple in10 min and you will see it isn't bad.
Dr. No
2009-12-16 01:15:46 UTC
no, people usually do it the other way around. Python is a hell of a lot easier than java and c or most anything else for that matter.



you got confused somewhere
sayan_nayas
2009-12-16 01:22:55 UTC
no need,oops concept will help you :)


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...