«Back to Home

Core Java

Topics

C++ vs Java

Difference between C++ and Java

There are many differences between C++ and Java, given below.

Comparison   C++   Java
Platform-independent  C++ is a platform-dependent language.  Java is a platform-independent language.
Used for  C++ is mostly used for system programming.  Java is mostly used for application programming.
Goto  It supports goto statement.  It doesn't support goto statement.
Multiple inheritance  It supports multiple inheritance.  It doesn't support multiple inheritance through class.
Operator Overloading  It supports operator overloading.  It doesn't support operator overloading.
Pointers  C++ makes use of the pointers. We can write a pointer program in C++.  Java supports pointer internally but we can't write the pointer program in Java.
Compiler and Interpreter  C++ uses only the compiler.  Java uses both compiler and interpreter.
Call by Value and Call by reference  C++ supports call by value and call by reference both.  Java supports only call by value.
Structure and Unoin  It supports structures and unions.  It doesn't support structures and unions.
Thread Support  It doesn't have a built-in support for the threads. It relies on the third-party libraries for thread support.  It has built-in thread support.
Documentation comment  It doesn't support documentation comment.  It supports documentation comment.
 
Summary

Thus, we learnt, C++ is mostly used for system programming and Java is mostly used for an Application programming and also learns many other differences between in C++ and Java.