As a
study abroad consultant in nagpu
r and
career guidance provider, I got some of the coding expertise in
C++ JAVA ORACLE n so... According to me
C++ is better because of following points :
Ah, click bait, but I'm going to bite (I love this s#!t)
First, let's get some things clear. Either you are very young and have never written systems in either Java or
C++, or you have never had to maintain any application written in either Java or
C++. In any case, you ain't no expert based on your claims.
C++ is compiled language whereas Java code is compiled as well as interpreted. That means execution of
C++ programs is faster than Java program.
This is not necessarily true. It depends on which sort of process are you running. Usually for trivial cases they are true but for long running process like server processes, things that run non-stop, Java has proved to be as fast as
C++ in the recent versions.
C++ supports operator overloading (
ad hoc polymorphism) it means we can perform computation on objects. Whereas Java does not support operator overloading.
You can achieve the same goal using functions. Operator overloading is just syntactic sugar to make things look nicer but can lead to confusion because you can obfuscate the meaning of the operator and make the code hard to maintain and read. For example, think about redefining the plus ("+") operator to do division on numbers. People will come up with all sorts of clever things when you give them the tools.
C++ supports multiple inheritance but Java does not support multiple inheritance using classes, which is accomplished using “interface”.
Oh no! It has been shown that multiple inheritance is a disaster waiting to happen because the code becomes intractable and hard to maintain. So the recommendation is to do in
C++ what Java and C# do, just inherit virtual functions
C++ use pointers whereas Java does not use pointers. So, directly we cannot do system level programming using Java
And this is a problem how? Smart pointers came to the picture because all the problems that having pointers create. You can do system programming in Java if you want. People don't usually do it not because of pointers but because of the garbage collector. As a system programmer you like to have deterministic outcomes and timings in certain situations and the Java garbage collector gets on the way some times.
Java and
C++ have their place in the "programmer's toolset". I don't think one is better than the other at this point. It just depends on what you want to do.