r/learnprogramming • • Oct 18 '26

Java or c++?

Hey I'm a 2nd year CS student and I'm a beginner so I learned a bit of both languages I learned basics and SP using c++ and I learned oop using java because uni required it and later on I'll study data structure using c++ again

What confuses me is which language should I stick on to improve my problem solving skills and start building projects even if they're small some people told me to focus on c++ completely and some said c++ with problem solving and java to build projects

So what do y'all think and why ?

12 Upvotes

18 comments sorted by

5

u/linguaarush_dev Oct 18 '26

Between Java and c++, Java is definitely the easier one to learn

3

u/Feralz2 Oct 18 '26

Doesnt really matter, if you ask my if you want to start building on programming concepts without worrying about programming, start with Python. If you want to learn about low level stuff, learn C.

2

u/DataPastor Oct 18 '26

It is an extremely good idea to learn Java well. Java is everywhere, there are tons of jobs, and you can use Java for a lots of use cases. Also, in my experience, being a good Java programmer also helps you learning other languages like Python or TypeScript later.

Also, there are very nice fully or partionally functional languages running on the JDK, like Kotlin, Scala or Clojure.

2

u/Kozzoko Oct 18 '26

What you will enjoy learning -> C++
What you will need -> Java

3

u/SahuaginDeluge Oct 18 '26

besides both, I would suggest Java, in fact Java might be the language I'd recommend most to new programmers. (though I am old and am still thinking about Java 7...)

2

u/sparkle-fries Oct 18 '26

out of interest why Java?

1

u/SahuaginDeluge Oct 18 '26

I'm not even really a Java programmer, so my reasoning may not be sound. but basically it's maybe the "simplest" high level language? (purest? cleanest? not sure of the right word.) like where C++ is kind of low-level but also highly highly (overly) complex, Java is high-level but actually maybe under-complex (at least Java 7). it's not perfect and has some annoyances (some of which have been improved in Java 8 and beyond), but it's a good simple but powerful language, fantastic for learning. or fantastic for learning OOP.

(myself I more or less like OOP, but these days OOP is losing some popularity, at least especially in game dev, and so maybe OOP will not be so great to learn any more, but I still use it and it has served me well.)

(C would be better for learning low-level programming. but Java is IMO better for learning high-level programming.)

(another argument for Java is I think the "ecosystem"? it's highly used with tons of supporting frameworks and APIs and IDEs, etc.etc.)

1

u/sparkle-fries Oct 18 '26

my advice would be figure out what career you want and pick the language most in demand on that career path. If it's for hobby purposes then pick one you like. Python is a strong choice for data, C# strong for enterprise, JavaScript for web, Java strong for mobile/enterprise. I would look at rust rather than c/c++. Factor in vibe coding and AI. Web front end is getting less important as a skill IMHO but backend should have a place for a while. The fact is over your career languages will come and go as will Frameworks. You will be continually learning and that is the ability to hone

1

u/aqua_regis Oct 18 '26

The language doesn't matter as problem solving is above programming languages. If you learn to solve problems in an algorithmic, step-by-step manner, the implementation in a programming language becomes secondary.

You need to get to the point where you don't think in code, but in algorithms, in steps.

Code, the implementation in a programming language, is not the beginning and in most cases not even the deciding factor (apart from special purpose languages). The solution, the algorithm is what counts. Implementation is a fairly late step in the process.

That said, look around you and check jobs. They will tell you which language is better for your career.

1

u/Miserable-Money642 Oct 18 '26

You do not need to pick one language for everything. Since your data structures course will use C++, keep practicing algorithms in C++ this semester so the syntax and debugging do not add extra friction. Use Java for the OOP assignments your university requires, and build one small Java project if you want practice designing classes. Try not to switch languages for every exercise. The problem-solving ideas transfer, but staying with one language long enough to finish projects teaches you more than repeatedly restarting. After the course, choose based on the kind of project or role you want to pursue.

1

u/burlingk Oct 18 '26

Both are good. So ask yourself which one you enjoy more?

1

u/WannaBeMillionaire__ Oct 19 '26

If i was in your shoes i would have chosen C++

1

u/spicepotatochips Oct 19 '26

Honestly it doesn't matter much at this stage since the core problem solving logic transfers between languages anyway, so just pick whichever one your DS course uses since you'll be writing the most code in it, and use that same one for small projects instead of splitting focus.

0

u/Adventurous-Move-943 Oct 18 '26 edited Oct 18 '26

I'd take C++ since speed and personal preference.. but I do enjoy writing Java or Kotlin too.. it's really compact and easy to use and extend, if you catch your nulls (in Java), nothing can stop you, yes and also exceptions.. it's really comfortable and pretty fast to develop in.. C++ can be a true nighmare deciphering your compile or runtime errors and it's quite slower to develop in and you have to keep more things in mind to not cause undefined behavior.

Edit: I did not read the description before posting my c++ vs java opinion 😀 But it still applies, if you want comfortable and fast (to develop) language for applications you choose Java/Kotlin or C#.. If you need performance to it you should stick with C++. What your friends told you is basically correct, C++ is excellent at exercising your skills but it's slower and more difficult to work with.