Comparison of C++ and Java (16 Difference)

C++ JAVA
1. C++ was developed by Bjarne Stroustrup. Development began in 1979.

Java was developed by James Gosling and his team. Development began in 1991.

2. C++ is a compiled language. Java is both compiled and interpreted.
3. C++ supports conditional compilation and inclusion. Java does not support conditional compilation.
 4. C++ programs are platform dependent. They need to be compiled for a particular platform. Java programs are platform independent. Java programs are written for Java Virtual Machine (JVM) and wherever a JVM is installed, Java program will run without needing recompilation.
5. C++ does support operator overloading. Function overloading is also available. Java does not support operator overloading. However, function overloading is possible.
6. C++ fully support pointers. Java has restricted support for pointers. Pointers are supported internally you can not writer pointer programs.
7. C++ supports structures. Java does not support structures.
 8. C++ supports unions. Java does not support unions.
 9. C++ does not have built-in support for threads. Java fully supports threads.
 10. C++ supports manual object management through new and delete keywords. Java relies on automatic garbage collection. It does not support destructors the way C++ does.
 11. C++ supports goto statement (however the use of goto is discouraged as not considered a good practice) Java does not support goto statement (although goto is a reserved keyword in Java)
 12. C++ supports multiple inheritance. Java does not really support multiple inheritance. But similar results can be achieved through the use of interfaces.
 13. C++ provides support both for call by value and call by reference. Java supports only call by value.
 14. C++ does not support comments within source code. In Java programs, you can write comments using  /** … */
 15. C++ has no support for the unsigned right shift operator ( >>> ). Java supports the unsigned right shift >>> operator.
 16. C++ provides virtual keyword to support function overriding. Java does not support virtual keyword. All the non-static Java functions are by default virtual in nature, and therefore, can be overridden.

 

One thought on “Comparison of C++ and Java (16 Difference)”

Leave a Reply

Your email address will not be published. Required fields are marked *