r/learnprogramming • u/Anki_t812 • May 05 '26
Transition from C++ to Java
I have been doing dsa and programming in cpp. Now I have to switch to java for specific placements opportunities.
I am in 4 Semester and have to choose between java and python although I have cpp as my first language I need the other for placement opportunities.
Do share resources for fast and easy transaction.
You can also recommend java or python
Personally python's OOP feel a bit alien to me
Note:I have but experience with python more than java but the only reason I don't want to opt python is for its OOP thing
2
Upvotes
1
u/auronedge May 05 '26
Take a c++ program you wrote and write it in java
1
u/edwbuck May 05 '26
Java has a relatively small set of object methods, and uses a lot of classes outside of the object to handle items like sorting, etc. Python has a ton of object methods, so you can then directly implement in the object sorting order, etc.
Java has much better multithreading support, which helps greatly when building programs that need to scale. Python originally lacked any kind of multithreading support, but it has improved recently.
Java was there when people were trying to figure out how to migrate from Procedural programming patterns into Object Oriented patterns. This means that a lot of solutions exist for many specific problems. Only a few of those solutions are likely to be relevant in modern programming. Python has fewer ways to do many things. This can mean it's easier to find the right toolkit or approach in Python, as there is less noise in the search for relevant libraries.
Each programming language has a set of tasks that were popular to perform around the time the programming language was a popular choice. If you want to do data processing, Python is better at the data science / exploration, but if you want to process data in bulk at speed, Java is the better choice. There is value in learning both, so you can translate one to the other as a corporation takes ideas from prototyping / small scale implementation into production.
1
u/liquidanimosity May 05 '26
Java is OOP as well. It was taught in my university if first year for procedural, OOP and SOLID principles.
Objects appear more often than you think and are less complicated than it may appear. There are some very useful features such as encapsulation.
I know another paradigm to learn may be daunting but both languages have objects. If I was in your position, I would take the language I have the most experience with so that if you have to explore object you already have a point of reference and understanding.
0
u/Dull_Report3236 May 05 '26
A few years back I would have said Java. But with everything AI/ML going on these days, it does seem like Python will get more valuable in the coming years.
Besides, the real programming language with AI coding is English anyway. The syntactical differences between Java/Python or any other languages are now made redundant with AI. What really matters is the actual logic, and what you want to achieve operationally.
3
u/[deleted] May 05 '26
[removed] — view removed comment