In this article, we will discuss what difference between java and c++.
Java is a true object-oriented language while C++ is basically C with an object-oriented extension. That is what exactly the increment operator ++indicates C++ has maintained backward compatibility with C.
it is therefore possible to write an old-style C program and run it successfully under C++. Java appears to be similar to C++ when we consider only the extension part of C++
However, some object-oriented features of C++ make the C++ code extremely difficult to follow and maintain. Listed below are some major C++ features that were intentionally omitted from Java or significantly modified
Also Read This:- Java features
difference between java and c++
java | c++ |
---|---|
Java does not support operator overloading | C++ supports operator overloading |
Java does not have template classes as in C++ | C++ has template classes |
Java does not support multiple inheritances of classes. java support interfaces as multiple inheritances | C++ supports multiple inheritances of classes. C++ does not support interfaces |
Java does not support global variables. Every variable and method is declared within a class and forms part of that class. | C++ supports global variables. |
Java does not use pointers. | C++ uses pointers. |
Java has replaced the destructor function with a finalize() function. | C++ has the destructor function. |
There are no header files in Java. | There are header files in C++. |
Java also adds some new features. While C++. is a superset of C, Java is neither a superset nor a subset of C or C++, Java may be considered as a first cousin of C++ and a second cousin of C as illustrated.