C++ vs Java
Comparison Index | C++ | Java |
Platform Independence | C++ is platform-dependent. | Java is platform-independent. |
Main Usage | Mainly used for system programming. | Mainly used for application programming. |
Design Goal | Designed for systems and applications programming. | Designed for embedded systems, settop boxes, televisions etc. |
Goto Keyword | Supports the goto statement. | Doesn’t support the goto statement. |
Multiple Inheritance | Supports multiple inheritance. | Doesn’t support multiple inheritance through class, achieved through interfaces. |
Operator Overloading | Supports operator overloading. | Doesn’t support operator overloading. |
Pointers | Supports pointers. You can write pointer programs. | Supports pointers internally, but doesn’t allow writing pointer programs. Restricted pointer support. |
Compiler and Interpreter | Uses a compiler only. Platform-dependent. | Uses both compiler and interpreter. Platform-independent bytecode execution. |
Call by Value and Call by Reference | Supports both call by value and call by reference. | Supports call by value only. No call by reference. |
Structures and Unions | Supports structures and unions. | Doesn’t support structures and unions. |
Thread Support | Doesn’t have built-in support for threads. | Has built-in thread support. |
Documentation Comment | Doesn’t support documentation comment. | Supports documentation comment (/** … */) for creating documentation. |
Virtual Keyword | Supports virtual keyword for deciding whether or not to override a function. | No virtual keyword. All non-static methods are virtual by default. |
Unsigned Right Shift | Doesn’t support >>> operator. | Supports unsigned right shift >>> operator. |
Inheritance Tree | Creates a new inheritance tree always. | Uses a single inheritance tree with Object class as the root. |
Hardware Interaction | Nearer to hardware. | Not so interactive with hardware. |
Object-Oriented | Object-oriented language. | Object-oriented language with everything (except fundamental types) as an object. |