The main difference between Java and C++:
Java is a true and complete object oriented language. C++ is an extension of C with object oriented behavior. C++ is not a complete object oriented language as that of Java.
Java does not provide template classes.C++ offers Template classes.
Java supports multiple inheritance using interface. C++ achieves multiple inheritance by permitting classes to inherit from multiple classes.
Java does not provide global variables. Global variables can be declared in C++.
Java does not support pointers.C++ supports pointers.
In Java, destruction of objects is performed in finalize method. In C++, destruction of objects is performed by destructor function.
Java doesn’t provide header files. C++ has header files.
Java is intrinsecally "write once run everywhere", while most C++ programs (especially mature software that was not born with cross-platformness in mind) can be work some to port to other platforms.
There is no goto statement in Java.
Exception and Auto Garbage Collector handling in Java is different because there are no destructor into Java.
Java has method overloading, but no operator overloading just like c++.
Memory leak risks are higher in java or C++?? Explain it.