Difference between Java and C++

Advertisements

Java vs C++

JavaC++
Java is pure object oriented programming language. We can't design and develop our programs and applications without object. C++ is semi object oriented language b'coz we can design and develop our programs and applications, with and without object.
Java is Dynamic, Java allocates memory at run-time. C++ is static, C++ allocates memory at compile-time.
Java doesn't support pointers, goto statement, operator overloading, templates, etc. C++ does support pointers, goto statement, operator overloading, templates.
Java doesn't support multiple inheritance. Java uses interface for multiple inheritance. C++ does support multiple inheritance.
Java supports automatic garbage collection. Java does not support destructors as C++ does. C++ does support destructors, which is automatically invoked when the object goes out of scope.
Java does not support default argument value. C++ does support default argument value.
Java has built in support for threads. C++ has no built in support for threads. Instead, c++ relies entirely upon the operating system to provide this threads.
Java compiler converts source code into byte code, which is platform independent. C++ generates object code and the same code may not run on different platforms.

Advertisement