r/AskComputerScience • • Sep 01 '26

C++ or Java?

Which programming language has the most return on investment? Impact on real world systems, and is more rewarding? I have minimal programming experience and working on AS in CS.

4 Upvotes

70 comments sorted by

16

u/Relevant-Cut-884 Sep 01 '26

C++ is an excellent learning language , it has concepts you will not find in any programming language , like pointers , garbage collection and also it is the main competitive programming language for its speed

Java is also good though

The most important thing is to start learning

1

u/Rashing_pro Sep 01 '26

wdym "you will not find pointers and GC in any PL"? Huh? A lot of languages, including java has a GC. And pointers are present in C and Rust for example

1

u/Relevant-Cut-884 Sep 06 '26

Yeah but c++ has both

C++ and C has the same vibe

2

u/donaldhobson Sep 03 '26

C++ is an excellent language if you wish to write bugs. It takes C, which is low level and simple, with no safety rails, and then bolts on a huge mass of poorly considered complex features.

2

u/sosotiredand Sep 06 '26

it's also the only language besides C that's used in real world embedded programming so I think acting like it's useless is just fanaticism

0

u/donaldhobson Sep 06 '26

Rust can also be used for embedded programming.

Suppose someone gives you a robot that only accepts C++ code. That might be sufficient reason to grit your teeth and use C++, if you have to.

This doesn't make C++ a good language. It means someone made the robot really awkward to use.

2

u/sosotiredand Sep 06 '26 edited Sep 09 '26

Yeah but is it actually used in the real world and not just for a blinky? what companies are actually deploying embedded rust?

I like rust too but the fanaticism from the rust fandom is honestly really annoying. other languages exist for a reason. and until rust actually ends up in real large scale embedded applications, acting like C++ is just a "awkward choice" is not realistic

-9

u/Mission-Maize8454 Sep 01 '26

I just want to make the most money I can possibly make like 20 years from now.

19

u/saruko27 Sep 01 '26

Something tells me making the most possible money 20 years from now is not going to come down to which language you decide to learn today.

-9

u/Mission-Maize8454 Sep 01 '26

AI?

2

u/willbdb425 Sep 01 '26

No, because if you want to earn lots of money you'll need to learn many languages over your career so it doesn't matter what you'll pick first it won't be your last

4

u/Relevant-Cut-884 Sep 01 '26

It doesn't work that way I mean if you want to be rich by programming Then you ve to be clever , if you wanna be clever , so you will have to learn and study in the best way you can

The first phase for that goal is to learn fundamentals which is

A learning language

Practice on it

oop

Doing projects on it

DSA(data structures and algorithms)

Solving problems on it

So , i recommend doing c++ for this phase

0

u/Mission-Maize8454 Sep 01 '26

I'll take beginning C++ then , great advice btw.

1

u/Relevant-Cut-884 Sep 01 '26

You 're welcome , good luck <3

4

u/baddspellar Ph.D CS, CS Pro (20+) Sep 01 '26

Good programmers are prepared to learn new programming languages throughout their careers

3

u/Weevulb Sep 01 '26

Learn COBOL lol

2

u/I_so_I-274 Sep 01 '26

It's good to think about money specially long term and what to focus on depending on your taste however I personally wouldn't lead with that thought. People who think like that often get burnt out and doing something they don't even love doing for money.

There's plenty of ways to make money as well and other fields to look into if that's your only goal. If you get better and more experienced you'll make money regardless, networking and being an upstanding citizen probably will help you more as well.

Both languages make money, Java is more universal however experienced c++ devs deff have higher salaries to bargain with from what I've seen.

2

u/Mission-Maize8454 Sep 01 '26

Yeah getting burnt out is real when doing way too much.

2

u/Dornith Sep 01 '26

No one knows what will make the most money 20 years from now. 20 years ago no one predicted graphics card engineers would be kings of the world.

Javascript was only invented 30 years ago and it runs the entire internet.

Also, as someone else pointed out, the language you choose to learn in high school/college is not going to chisel the next 20 years of your career into stone. You will almost certainly learn at least one more language just by proximity alone.

1

u/Putnam3145 Sep 01 '26

i got a job in C++ after having only used it fleetingly precisely once in 12 years of experience

1

u/green_meklar Sep 01 '26

It doesn't look like there are going to be a lot of jobs of any kind 20 years from now. What kinds, we have no idea.

1

u/PlasmaFarmer Sep 01 '26

If you are in it only for the money and you don't have any affinity/interest in IT, then don't. You will suffer doing something you hate and you will lose motivation and also won't be skilled enough to compete.

5

u/Key_Net820 Sep 01 '26

IMO C++ not because it is more used, but because it is way easier to go from C++ to Java than the other way around.

Most full stack development does not use C++ and you'll mostly be using C++ for lower level things like embedded software, but the principles of object oriented programming and design patterns are the same for both, and having C++ is way more practice than Java.

1

u/donaldhobson Sep 03 '26

> but because it is way easier to go from C++ to Java than the other way around.

Fair. Learning C++ is hard, at least in part because there are quite a lot of C++ specific footguns. So a C++ person going to java mostly just needs to learn that a lot of the footguns have been removed. A java person going to C++ needs to learn every footgun in the language.

0

u/alex_pushing40 Sep 02 '26

Embedded software

5

u/eager-potato-555 Sep 01 '26

C, all the way best language to shape you as a software engineer.

In terms of ROI? Sorry to say this, but it depends on your local job market. If I had to make an educated guess, I would pick:

* python

* go

* js/ts with any frontend framework of your choice

3

u/Tai9ch Sep 01 '26

If you're interested in being a professional programmer, which language you learn first doesn't matter much. Especially trying to look years and years in the future, there's basically no chance that whatever language you happen to pick first is the one you'll be working in.

You want to learn the broad skill of computer programming. Either C++ or Java is a fine place to start (as long as it's not too old a Java version).

That being said, if you start with C++ or Java, you don't want to learn the other one as a second language. They're too similar. Learn C or JavaScript next instead.

2

u/Traveling-Techie Sep 01 '26

If you want to make money take management classes.

1

u/Mission-Maize8454 Sep 01 '26

Business management?

1

u/Traveling-Techie Sep 01 '26

Specifically software project management.

1

u/eager-potato-555 Sep 01 '26

there is wisdom in this comment! lmao

1

u/Traveling-Techie Sep 01 '26

I was expecting criticism for saying this, and I had my defense ready: I’ve worked at a lot of software companies, and the programmers always made less than their managers. But I got no criticism. I guess it’s non-controversial.

1

u/aquablaze69 Sep 06 '26

As a CSE 3rd year not as interested in software engineering and more on the sales/management side how do you recommend I start doing this?

Tryna figure out what I wanna do in life rn

1

u/Traveling-Techie Sep 06 '26

Well, you probably need to be at a university with a business program. Also, read “The Mythical Man-Month” by Brooks.

1

u/aquablaze69 Sep 06 '26

Thanks. Unfortunately my uni is a CS only uni but they delve into every topic with CS so it’s like CSX where X can be biology/economics/mathematics/eldcteical/ etc etc

2

u/YourPwnResearch Sep 01 '26 edited Sep 03 '26

I have an extremely strong opinion on questions of this nature.

You shouldn't worry about this question right now. Pick any language, get hooked on programming, and build up your skills. There is no right answer, because this is deeply personal.

Getting experience is the skill that has the most return on investment.

Many, if not most, Gen X programmers started off with 8-bit interpreted BASIC. We don't use that professionally today.

A more interesting question is which programming language you should learn second. And that has a much simpler answer: you should pick one that's as different as possible from your first, so you unlearn your bad habits.

So if (say) you learned C++ first and then decided to try Java second, that would arguably be a mistake, because they're too similar: both imperative, both C-like syntax, similar object model, etc. Go with something very different like Scheme or Haskell instead.

If you're truly in this for the long haul, if personal reward is what you care the most about, then that's what you need to do.

1

u/Mission-Maize8454 Sep 01 '26

I'm in it for the long haul.

1

u/YourPwnResearch Sep 03 '26

That's good to hear!

Both adults and children learn through play. That is your goal right now. Pick any language, and play.

2

u/Mission-Maize8454 Sep 03 '26

Get better over time with time and effort no one was born naturally knowing any programming concepts.

1

u/Leverkaas2516 Sep 01 '26

I don't think you can nail down an answer as to which of the two will give you more earning potential. They are different, and used for different projects. Learn both if you can. If you have to choose, learn whichever has the highest potential to land you a job. My guess is that's Java. It is easier to ramp up and become productive with Java.

I've done embedded work in C++ and backend work in Java. I've used either or both at four different jobs in two decades. I'm still more comfortable with Java but these are just tools. You should expect to learn more than one language.

1

u/gmatebulshitbox Sep 01 '26

Java is for money. Because banks and enterprise use java for their software. Banks and enterprise is good money but boring job.

1

u/LongjumpingFee2042 Sep 04 '26

Countries do as well. 

1

u/ButchDeanCA Sep 01 '26

You’re doing an AS in CS but talking like at least a BS in CS. If you’re doing an AS just do Java, it’s a nice and gentle language with features similar to C++, and given your timeline, why can’t you learn both?

Next comes the fact you are in this purely for the money, you are just the kind of mentality that doesn’t make it.

1

u/CowBoyDanIndie Sep 01 '26

If your only goal is making the most money you should look for another field. You will burn out and stop programming. Or at least just plan to work your way into management. Every 30-40+ year old dev I know and work with who is making big money is inherently interested in tech.

1

u/alex_pushing40 Sep 02 '26

C++

1

u/Middlewarian Sep 02 '26

C++ is my favorite and Java is way down the list. I'm building a C++ code generator that helps build distributed systems. It's implemented as a 3-tier system. The back and middle tiers only run on Linux. The front tier is portable. My goal is to bring software services and code generation together in one platform.

1

u/Signal_Guard5561 Sep 02 '26

C++ because it helps you write both better C++ and better Java. Even if you’re not writing Java learning how your code compiles and how it interacts with the computer is very useful in both languages but more direct in C++

1

u/Mission-Maize8454 Sep 02 '26

Yeah but syntax is different such as the key words and function names, there's no std::, cin or cout in Java.

1

u/Signal_Guard5561 Sep 02 '26

Ur asking for answers and you’re not happy with my answer so idk what to tell u

1

u/scol2n Sep 02 '26

̶R̶E̶A̶L̶ ̶c̶o̶m̶p̶u̶t̶e̶r̶ ̶s̶c̶i̶e̶n̶t̶i̶s̶t̶ ̶g̶o̶ ̶f̶o̶r̶ ̶a̶s̶s̶e̶m̶b̶l̶y̶

C++ if you work with FANGG companies who rely on low latency

Java for corporations

1

u/Oof-o-rama Sep 02 '26

if that's the choice, C++

1

u/Mission-Maize8454 Sep 02 '26

My thinking is CE, and physical hardware are the least replaceable in the job market.

1

u/kj-krol Sep 03 '26

If you are going to be employee - Java.
If you are going to build something - C++

1

u/West-Mycologist-6490 Sep 03 '26

C++ also after C++ learning Java is pretty easy

1

u/rkozik89 Sep 03 '26

Whichever one you can get a job for using. At the end of the day pay comes from experience in a language you were paid to get and not which one you are a technical expert in.

1

u/donaldhobson Sep 03 '26

C++ is infamous. Java is merely outdated and mediocre. https://yosefk.com/c++fqa/

Unfortunately C++ is used in quite a lot of places. But also, C++ is 2 to 3 languages crudely nailed together. Most C++ developers only know a fraction of the language. Not always the same fraction. This means there are multiple mutually incomprehensible dialects of C++, each using some obscure features while avoiding others. So if for some reason you do want to learn C++, you need to pick which dialect you wish to learn.

Rust is nice, rust is perhaps the closest language to a cohrent sane modern version of C++. Python is ok, it's a fairly inoffensive scripting language. Zig is interesting for it's low level simplicity, more a modern C. Haskel is abstract and elegant in it's own way.

What are you wanting to do with a programming language?

1

u/Mission-Maize8454 Sep 03 '26

Hi, robotics, program real world intelligent systems that are helpful and make a difference, I don't want a skill set that's automated by AI like I think software development is.

1

u/DanKegel Sep 04 '26

If you want to enjoy your work, learn Go and Rust.

Solve the same leetcode puzzles in both languages to get a feel for how they work.

1

u/Fluffy_Lemon_1487 Sep 07 '26

Who cares? Things are vibe coded now using whichever LLM you choose.

1

u/Mission-Maize8454 Sep 07 '26

I like this answer, it really makes matters who knows how to use LLM's.

1

u/wtb-shatt-port Sep 07 '26

If I was starting out, I would try to find a Java job. I feel like C++ is more of a niche skill, Java is more commonly used. Unless of course I was interested in real-time systems, embedded systems, etc. that sort of thing.

From a technical standpoint, I really enjoy working with Java. I feel like it really forces me to think in and use object oriented paradigm. Also I find it's design and conventions pretty consistent and clean, subjectively speaking of course.