Java, or C++?

Pages: 123... 7
I've been talking amongst collegues in computer science, and I keep on hearing that companies want people who know Java. I don't want to learn Java if I can avoid it, but it would be practicle: Portable, runs on anything, and cost efficient, right? Not to mention all the job listings for java devs which support the argument. So, I find myself asking a question I never thought I would ask: Why should I program in C++, if there is such a high demand for Java?

In the long run, which is better, and why: Java, or C++?

My argument is that anything you can do in Jva, can be done in C++, simply by writing igh level functions and re-using them. This, however, is vain because companies are still only asking for Java devs, not C++ devs (and I have seen little-no job posts for C++ developers, compared to job posts for java). Is is employer ignorance, or do they have a real reason for this? Should I chuck C++ for Java and start all over? Give up efficiency for functionality?
Last edited on
Java is only usefull because of its portability amost any machine with the JVM.
C++ is master race (just kidding) but it's extremely useful for things like game design (like in unity; although I think thats coded mostly in c#)
so... Anyone else want to chime in? :\
Edit your thread and move it to the Lounge.

In the long run, which is better, and why: Java, or C++?

I hope both of them will fade into obscurity sooner than later.

Personally, I have a hate-hate relationship with C++. I've tried to master it over the years, but it fights back too much. I'd go with Java just for the promise of it being a well-designed high-level language.
Last edited on
closed account (9wqjE3v7)
I think it really depends on what you are doing. C++ is used widely among programs where speed is crucial. It also provides some 'lower' level features, such as pointers and memory management, where the programmer has more control over system memory. Java has garbage collection, it automatically deallocates memory when it is no longer needed for you.

Java is certainly growing in popularity, it is used everywhere. You can definitely be more productive in Java than you can in C++ at times, which is why C++ is irrelevant and unnecessary for quite a few tasks, since Java's functionality is enough for the job, and development time is usually faster, speed is irrelevant.

Java is also used widely on mobiles, which again, is another rapidly growing market.

It really depends what you want to do.
companies are still only asking for Java devs, not C++ devs (and I have seen little-no job posts for C++ developers, compared to job posts for java)

What kind of companies (by industry sector) were you looking at? Where I work today (financial sector) we have over a thousand C++ developers and not a single Java-related position (as far as I know). Previously (transportation sector) I was at a place with one Java position, which disappeared over the years, against 10-20 C++ positions.
I am seeing a massive shortage of qualified C++ programmers, actually, and with all the colleges that turned into Java mills, it won't change anytime soon.
closed account (3qX21hU5)
Just to add something else to this conversation. Learn both of them. If you are looking to program more then as a hobby it is basically a must that you be able to work in more then one language.

Each language has different tasks its suited for. So why not learn a language out of each category? Learn a powerful lower level language that gives you a bit more control like C++, also learn a high level object oriented language like Java or C# that can produce them little applications quickly, also learning a scripting language can be handy.

My whole point is don't restrict yourself to learning only 1 language and playing favorites. Learn a myriad of languages. This will help your resume A LOT and it will also give you the freedom to select the best language for your task.
@Cubbi
I am seeing a massive shortage of qualified C++ programmers, actually, and with all the colleges that turned into Java mills, it won't change anytime soon.



I am seeing that in the real life occupation does not depend on qualification.:)
being a beginner of both I can tell you that you will build more powerful programs in c++ but you will feel like your making progress in java sooner, c++ is like a high level machine language java is like something that makes stuff for you.
Programming is about solutions to problems; engineering. Programming is less about language skills or specializing with a particular framework.

Focus on understanding solutions to programming problems. Then how to solve that problem in the language at hand.

Your experience with programming in different languages will lead you to the point where the conversation leads too, "There are several solutions to this problem. What functionality is available in the tool box that I am using?".

The tool box is different for different languages and environments.

The programmers that I want to work with can adapt to new languages, tool boxes, frameworks and environments as needed.
wow... I was expecting at least a littleb bit of consistency in the answers (for the sake of confirmation), but alright.

@Cubbi
I am looking at no specific industry. I am looking at billboards at college which has job posts put up by companies who are looking to hire college students, interns, or grads. I see no C++ job listings, and when I do, I see them requesting bachelor's/master's for the job. All of the rest of the coding posts are Java programmer positions, and some just want someone who knows the language (not specifically with a bachelor's or higher). From my perspective, the job market for C++ programmers who have not recieved a degree (also, i've been writting C++ for over a year and a half now...) is pretty closed, if not locked.

@everyone:
I think everyone agrees with the following: "It's better to learn more than one language, than to only know a single language."

Would you also agree that Java and C++ are the best languages to learn for the purposes needed? Are there any others you would recommend (please only proffessionals answer this one)?

Thank you for you're advice. I very much appreciate it.
Last edited on
To be a solid software engineer you should know multiple languages.

However I don't like Java... so I would vote C++ and C# as your main meal with a side of Python or Ruby... :p

edit:
Cubbi is right, C++ is still the most used language by the way.
Last edited on
Would you also agree that Java and C++ are the best languages to learn for the purposes needed?
For what purposes? For exmple if you want to be a system programmer, Java is off limits for you, and in lesser extent C++: Most of the lowest level stuff you will be doing in C with some C++ in userspace. If you want to write high-load system C++ and a little bit of C is for you. If you want to write mobile apps or high portable application, you probably want Java. Game developers usually stuck with C++ for engine or/and some more abstract language for other stuff (Lua in WoW interface and many other games, Python in Civ4).

Use the right tool for any given task. And learn programming in general, not bound by specific language: good mechanic should now what is he doing, not only his tools, and be able to use tools he happens to have now, not only those he accustomised with.
program into your language, not in it
— Steve McConnel

closed account (3qX21hU5)
Would you also agree that Java and C++ are the best languages to learn for the purposes needed? Are there any others you would recommend (please only proffessionals answer this one)?


I would definitively add .NET(Mainly used with C#) in the mix.
C++ is probably one of the most valuable single languages to know, because even if you are required to work in a different language you will probably have a pretty good idea of how to use most of the language's features because they were in C++. I would suggest focusing more learning to quantify large problems into bite-sized steps than on mastering any6 one language. It's also advisable to learn several different languages (as in, languages with vastly differing syntax) to lessen the learning curve of most other things that you'll eventually end up doing. Just be flexible and willing to learn new things, locking yourself into any one language is completely foolish.
closed account (N36fSL3A)
Oh god, a RapidCoder will soon appear.
If you want to select a more effective path then I advice to learn Java instead of C++.
closed account (N36fSL3A)
A RAPIDCODER was not sensed! I would learn both.

C++ is probably one of the most valuable single languages to know, because even if you are required to work in a different language you will probably have a pretty good idea of how to use most of the language's features because they were in C++


O'rly? I have a big Erlang project lying around. Would you like to submit some patches? ;)

Locking yourself in a single language is foolish and learning new syntax is usually the easiest part.

But if you really have to decide on one single language - choose pure C. Pure C can be compiled on everything, probably everyone knows it, and almost every other language can easily interoperate with code written in C.

BTW: Java is used also very much for system level programming. Database systems or high frequency trading platforms* are system level programming IMHO. And not because of its portability, but because it is much more agile. There is not that much difference between Java and C++ these days (C++ guys doing kinda GC with smart pointers and Java guys doing kinda manual memory management with direct byte buffers, lol).

*Last week at the NoSQL conference I was talking to a guy that worked in a company providing a HFT platform. After 5 minutes talking about how they manage threads / locks and queues I asked him which version of GCC they compile stuff and which options they use.
- "GCC? Who told you we are using GCC? We are using Azul Zing... Java." :D
- But all the rest is using C++...
- Maybe 6 years ago.
Last edited on
Locking yourself in a single language is foolish and learning new syntax is usually the easiest part.
But if you really have to decide on one single language - choose pure C
Completely agree on that.

Java is used also very much for system level programming
Well I didn't saw any highload device driver written in Java.
Database systems or high frequency trading platforms are system level programming IMHO
Looks like we have different definitions of "system" programming :)

C++ guys doing kinda GC with smart pointers and Java guys doing manual memory management with direct byte buffers
And there is garbage collectors for C++.
Well I don't want to argue about language popularity and think that arguments that some language is "better" than other is pointless.
Last edited on
Pages: 123... 7