Sign in to follow this  
Simpsons4261

Java vs. C++?

Recommended Posts

My situation: Over the summer I learned a little bit of C++ but then once school started I stopped learning it. I'm in my senior year of high school and next year I go to college. In college I want to major in computer science and become either a game programmer or a software programmer. Now I want to start learning a language again, but I don't know if I should go for Java this time since some say it is easier to grasp the syntax and get all of that down or if I should go C++. I plan on learning them both eventually. What are the pros/cons of learning each language first and which one do you recommend?

Share this post


Link to post
Share on other sites
There's a good chance that your University may start you off on Java.
There is also a good chance that you would find Java an easier language to learn than C++.

In the long term, if you're learning both anyway, then it doesn't matter - you won't be screwed over by learning one of those languages before the other.

Share this post


Link to post
Share on other sites
Learn one of them, preferably the one you come in contact with later at the university (as mentioned before), but DO NOT stick to just this language. After learning it, have a look at other languages. I'd recommend looking at Python, and trying out stuff that wasnt possible in C++ or Java. For example, try out to code in a functional style in Python. Then, move to something like Haskell. The idea is not to know as many languages as possible (which is useful, but not the primary goal). The idea is to see different perspectives, different ways of solving problems. This greatly enhances your programming skills.

Share this post


Link to post
Share on other sites
I would recommend C++ coz most of the API's are compatible with C++.
For ex Directx doesnt run with java.
If u want to become game programmer go with C++ then learn java.It will be a lot easier.

Share this post


Link to post
Share on other sites
If you can figure out what language you'll have to use at college/uni that's worth learning obviously.

Otherwise, I'd simply say Java as it's easier to learn good OO programming in that language without getting too bogged down in hardware related details. Certain elements of C++ requires an understanding of what's happening at the machine level (eg. pointers).

Not only that, Java is a leaner language than C++ and does not have one million ways to do the same thing. It's simply easier to write good code for Java.

Edit: Actually, I learnt C++ first (after Basic lol) because Java was so hideously slow back in that time. Would I have to make the same decision today however, I'd go with Java.

Share this post


Link to post
Share on other sites
if you want to make makes go with c++(every good graphic api is c++) if you want to just do apps and web work go with java (java uses native gui) but java dousent make very great games. Also learn aton of math.

Share this post


Link to post
Share on other sites
Obviously, if you can find out what your first programming class will use, learn that. Then, and this is a point that is often glossed over, use that first class to enhance and flesh out your knowledge of the language. Don't flake out because you THINK you already know it, use the class to make sure what you've taught yourself is as complete as you can make it.

If you don't know what you'll be taking, then go learn both. Really. Java might be a better intro to object-oriented programming, C++ will allow you to learn more hardware-level stuff along side your object oriented programming. But knowing both will make you a better programmer, and with every programming language you learn the next one gets easier to pick up.


I personally don't like Java, but I'm far from even decent at it, so maybe if my knowledge was complete I'd be in love with it.

IF you want to quickly dive in and make a game, Java will be far easier. I'm talking games on the level of Tic-Tac-Toe and Pong here. Everything you'd need is built right in and there's tons of tutorials out there. Doing that in C++ is a bit tougher, and might be frustrating for someone just starting out.

Share this post


Link to post
Share on other sites
Quote:
Original post by Z_of_Thule
c++ gives you more power when making a game, BUT IS NOT FOR PEOPLE STARTING OUT IN PROGRAMING!!!

Perhaps you can give an example of this power? Something that can't be done if you're programming in Java?

Both languages are equally "powerful" and can express the same things, although sometimes one language may be a lot more verbose than the other.

Share this post


Link to post
Share on other sites
Quote:
Original post by Spoonbender
Quote:
Original post by Z_of_Thule
c++ gives you more power

Perhaps you can give an example of this power?

C++ can order anchovis pizza with a single line of code:
i++ + i

Share this post


Link to post
Share on other sites
Quote:
Original post by DevFred
Quote:
Original post by Spoonbender
Quote:
Original post by Z_of_Thule
c++ gives you more power

Perhaps you can give an example of this power?

C++ can order anchovis pizza with a single line of code:
i++ + i

LOL!
Ain't it the truth.
Anyways, don't confuse power with freedom. Java is like your boss telling you what you have to do and how you have to do it whereas C++ is like I don't care how you do your job as long as you get it done.
I think this quote explains what I am trying to say the best:
"In C++ it's harder to shoot yourself in the foot, but when you do, you blow off your whole leg." — Bjarne Stroustrup.


Thus I recommend you learn Java since if you haven't already made up your mind since it makes it impossible to blow off your leg-LOL!
You can do that later with C++ if you want;)

p.s. Here's another pretty good quote I just came across I never seen before that sums up my feeling on C++ if you haven't already noticed:
"Writing in C or C++ is like running a chain saw with all the safety guards removed," — Bob Gray.

Share this post


Link to post
Share on other sites
Thanks for all the suggestions guys! I think I'm going to go Java first.

Now onto another question, which book would be better?

Beginning Java by Ivor Horton (or something like that)

or

Head First Java

or

possibly something else?

Thanks!

Share this post


Link to post
Share on other sites
I second the advice about the Java tutorials. There is really no use paying for a book on a subject that is covered very well by material that is freely available.

I have taken two separate courses that use Java, and each time those tutorials were better than the book or the instructor.

Share this post


Link to post
Share on other sites
Quote:
Original post by Simpsons4261
Beginning Java by Ivor Horton (or something like that)


The Java Tutorials are good, but this book is, IMO, the best introduction to Java out there. It's more in-depth than the Java Tutorials, covers a lot of bases, and makes a great reference even after you are comfortable with the language.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this