Difference between java and C++

Slno Java C++
1 Java is platform-independent. C++ is platform-dependent.
2

Java is mainly used for application programming. It is widely used

in window, web-based, enterprise and mobile applications.

C++ is mainly used for system programming.
3

Java doesn't support multiple inheritance through class. It can

be achieved by interfaces in java.

C++ supports multiple inheritance.
4 Java doesn't support operator overloading. C++ supports operator overloading.
5 Java uses compiler and interpreter both. C++ uses compiler only
6 Java doesn't support structures and unions. C++ supports structures and unions.
7 It does't support Pointer concept It support pointer concept.
8 Java includes automatic garbage collection C++ requires explicit memory management
9 Java has no virtual keyword. We can override all non-static methods by default. In other words, non-static methods are virtual by default. C++ supports virtual keyword so that we can decide whether or not override a function.
10 Java supports documentation comment (/** ... */) to create documentation for java source code. C++ doesn't support documentation comment.
11 Java supports call by value only. There is no call by reference in java. C++ supports both call by value and call by reference.
12 Java has built-in thread support. C++ doesn't have built-in support for threads. It relies on third-party libraries for thread support.

Posted on by