The Java and C++ both are Object Oriented programming languages, but still there are some differences between the Java and C++. A comparison table is given below with some important difference between C++ and Java.
| Parameter | Java | C++ |
|---|---|---|
| Platform Independent | Java is platform independent and architecture neutral. | Platform dependent and architecture neutral. |
| Usage | To develop application softwares, mobile apps, web applications, etc. | Mainly used to develop system software |
| Pointer | Does not support explicit pointer and pointer arithmetic. | Support explicit pointer and pointer arithmetic. |
| Multiple inheritance | Does not support multiple inheritance for class but supported for interfaces. | Supports multiple inheritance with the help of virtual functions. |
| Operator overloading, structure, union | Does not support operator overloading, structure, union, etc. | Support operator overloading, structure, union, etc. |
| GOTO | Does not supports goto statement. | Supports goto statement. |
| Runtime | Uses compiler and interpreter. | Uses compiler only(uses runtime of the Operating System). |
| Call by reference and call by value | Java does not support call by reference. call by value supported only. | Supports both call by value and call by reference. |
| Multithreading | It has inbuilt threading concepts to implement. | It has no inbuilt threading concept, third party library is required to implement multi threading concept. |
| Virtual keyword | Java does not have a virtual keyword, but all the non static methods are virtual by default. | It has virtual keyword to indicate if the function is to override using inheritance. |
| Memory Management | Java has inbuilt garbage collector to destroy unused objects. | It uses destructor to free the unused memory space. |
| Documentation comment | Java support documentation comment (/** */) | C++ does not support documentation comment |