Java is a general-purpose programming language that is class-based, object-oriented, and designed to have as few implementation dependencies as possible.
C++ is a general-purpose programming language created by Bjarne Stroustrup as an extension of the C programming language, or "C with Classes.
Comparison Index |
Java | C++ |
---|---|---|
Platform-Independent | Yes | No |
Goto Statement | Not Supported | Supported |
Use | Application Programming: Window, Web Based, Enterprise and Web Application. | System and Application Programming |
Multiple Inheritance | Not Supported. You can achieve it using interface. | Supported |
Operator Overloading | Not Supported. | Supported. |
Pointers | Restricted. Can not use in Program. | Supported. |
Compiler and Interpreter | Compiler + Interpreter | Compiler Only |
Call By Value and Call By Reference | Call By Value Only | Both |
Structure | No | Yes. |
Union | No | Yes |
Threads | Yes | No direct support. Relies on third party libraries. |
Documentation Comment | Yes | No |
Virtual Keyword | No. Java has no virtual keyword. We can override all non-static methods by default. In other words, non-static methods are virtual by default. | Yes. C++ supports virtual keyword so that we can decide whether or not override a function. |
Unsigned right shift >>> | Yes. It fills zero at the top for the negative numbers. For positive numbers, it works same like >> operator. | No. |
Inheritance Tree | Uses single inheritance tree because all classes are the child of object class in java. | Create a new inheritance tree always. |
Hardware | Java is not so interactive with hardware. | C++ is nearer to Hardware. |
Object Oriented | Yes. Single root hierarchy as everything derived from java.lang.Object. | Yes. No single root hierarchy. |