Answer the question
In order to leave comments, you need to log in
Java vs C++. What is more useful?
I started learning Java, before that I knew C ++ well. Now the question is, which language is more relevant now for common tasks? Which one is more needed and welcomed more?
I know C++ powerful, but the possibilities of Java are also interesting. I hope someone will be able to put the "Pros" and "Cons" about each, so that there is no longer any doubt which language to focus on and develop more.
Answer the question
In order to leave comments, you need to log in
depending on what is considered "common tasks" ...
the first thing to understand is that each task has its own tool, and especially you need to remember that the tool can be used for other purposes.
let's say a screwdriver can hammer nails, it can even be used as a chisel or chisel, but it is not intended for this and using a normal tool you will be much more productive.
for example, in Java, in comparison with C ++, it is easier and faster to write cross-platform applications or multi-threaded applications, and at the same time they will work faster than C ++, but when it comes to hardware or bulk work on memory, it is faster and easier to write in C ++ and work will be faster than Java.
and the whole point is that you don't have to say "Java" or"C++", we must say "Java" and "C++", due to the fact that there is JNI, you can easily transfer all the loaded calculations to C \ C ++, and leave everything else in Java, and get the best of both worlds.
I don’t know about Java, but I’ll talk about C ++ and C #, even though the latter is compared with Java.
Macros, untyped templates, partial implementations of these very same templates, pointers, constant references, constant methods, unary operator overloading, splitting memory into stack and heap - these are just some of what I miss when programming in C#.
With the help of pluses, you can write a program of any complexity and at the same time there is always a path where you can choose a logical style and stick to it throughout the development, alas, there is no such thing in C#.
It is also worth noting that C++ does not end with bare syntax and STL, after you get to know them, a whole world of different libraries will open before you. From the abundance of high-quality mathematical libraries that are in C \ C ++ (and you can absolutely easily link to the project and use the first one without problems), my keyboard is flooded with saliva. And Qt with its signals and slots .... And yes, do not believe that multi-threaded applications are complex pluses, Qt and C ++ 11 simplify to the limit.
And when the pampering is over and you realize that you need to solve problems more seriously, a new world will open before you: you will start studying the compiler and learn a lot about its keys and optimization possibilities. you will learn how you can speed up your program using SSE, what OpenMP and OpenCL are.
Yes, C++ is strict and merciless; learning it is like playing chess against a superior opponent, where any small mistake can be fatal. But working in C++ (working, not coding in such a way that you get off) you will get much more in understanding how It-technologies work, what they are based on and what are their limitations.
All coders are needed, all coders are important.
I advise you to look at some headhunter site, which specialists are more wanted and for what.
I wonder why in Java vs C++ comparison many people mention that Java is cross-platform. C++ is also a cross-platform PL. The program written on it can be compiled under almost any platform. Yes, a C++ program cannot be ported at the level of binaries, but how often have you seen universal binaries?
For C++, there are many very useful libraries that allow you to write a beautiful and fast GUI (the only good GUI program I know written in Java is Eclipse). Most desktop applications are written on the pluses.
Native multithreading appeared in the new standard (however, no one bothered to use one of the many cross-platform libraries to achieve the same goals before).
Of the main shortcomings of C++, I will say that the first 2 years of working with this language, the programmer harms more than helps. This is given that he already knows the syntax well and is already writing some programs on it. A huge number of hidden pits, rakes, loaded guns - carefully laid out by the creators of several versions of the standards, in a crazy dream of backward compatibility of the language (which, of course, is very cool).
For self-development? Learn whatever you like. Any knowledge is not only information, but also ideas, thoughts, concepts, etc. of your predecessors.
For work? What kind of work you want - such a stack of technologies and choose. Compare vacancies and choose the set that you like. Too many strangers? Try just a little and you yourself will understand what your soul lies in.
Freelance? Even easier. Take Java or C# for desktop programs or applications for Android and Windows Phone. These languages and technologies are similar. If you want the web, then it's a little different. If the goal is to make money, then start with PHP and quickly come to the conversion of your efforts into money. If you want self-development + freelance. You can write in PHP and feel free to do so, but learn another language at the same time. You can use Python / Ruby or the same C++ / Java.
Working on a task? Choose the language that suits you best.
The advantages that I have identified for C ++:
1. OOP along with the advantages of C;
2. Compilers for all platforms;
3. Speed.
Advantages which I allocated for Java:
1. Cross-platform;
2. Convenience;
3. Similarity to C# (more precisely, on the contrary, I write a lot in C#);
From the last. Under Windows, I wrote a program for Mac without having it. I corrected a couple of lines and everything works.
From my own experience, I can say that Java is the best way to start a career. A year ago, after graduation, I was actively looking for a job to start a career as a programmer, I wanted to write in C / C ++. Basically, they wanted a Javist everywhere. Pushed around for a couple of months, spat, got an interesting job teaching Java. Now I only sometimes solve small problems on the pluses, Java is very pleasing.
Agree with DancingOnWater. C++ is a game of chess with a grandmaster. After such games, and only after such games, you understand that there is chess. But it requires insane tension, ruthlessness to yourself, time and great desire.
Is C++ practical for shit coding? No. He will be merciless. And in this ruthlessness is his strength. Code written perfectly will work perfectly. But where is this ideal? And how long will it take you to find your C++ zero?
Why play chess with a grandmaster when you can easily beat your neighbors? And what will such a game give you? What are you striving for? Only you can answer these questions.
At the same time, I do not quite agree with him that he mentions STL somewhat dismissively. Already STL alone, but not only basic containers instead of arrays, as it is usually used, but in its entirety, along with Boost, which conceptually expands it, is a blow to the unprepared mind. And here is the power that must be acquired by one who wishes to play chess with grandmasters.
I did C++\Qt for a year, but then dumped it in favor of Java, despite the release of C++11.
You can earn money here and there, C ++ is good, but still it is becoming obsolete. Choose Java - you won't regret it!
Looking where to apply? then it's better there. Java has a big advantage. It is practically involved in all areas, and is good for certain tasks in each of its areas of application. For example, in the web, it’s cool to use a video chat server, an online cinema with pseudo-streaming and commercial breaks without Java. (Node, Python, Ruby with modules and scribbles will be able to do this, I won’t talk about php). But this is not a reason to learn Java. Since a large functional project is ordered only from firms. And for a small site to your friend, only php + WP or Laravel. I lead to the fact that for small tasks a powerful tool is just as inaccurate as it is not powerful for a complex task. Java basically knows how to do everything the same as C ++,only the essence of Javi is to sacrifice performance but to untie the user from working with memory, and the operating system API (WIN API, POSIX). The JVM is like a layer between these complex things and your Java program. In general, Java is used with might and main where performance is inappropriate; Google and Yandex employees love it. When it comes to critical performance, immediately tears in the eyes and "oh no again this C ++ build glitches, open source possibly glitched GCC plugins or libraries for specific ones can give 1000 build errors + their powerful computers sometimes compile 10 hours of CPP projects" from For this, Google workers (the guys involved in the development of Unix and Java back at SUN Microsystems) who are tired of C ++ created GO for their tasks. Yes, C ++ is powerful, they made it powerful and pushed everything that is possible there, but they sacrificed everything. This is a tool for large corporations where at least 10 people will puzzle over a glitch. If you still want to try it, I advise you to write under the WIN API in Visual Studio. there are a lot of standards out there. and getting a unique glitch is very difficult. and as a rule there are answers to many glitches. something like this.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question