This is a very famous question asked in many interviews (specially to Programmers)…
C++ was developed as an extension of C. C++ added object oriented capabilities to C and became very popular. It is still widely used for many low level programming jobs. C++ was influenced from Smalltalk the first object oriented programming language.
Java was influenced from C++.
C++ has got pointers but in Java there were no concept of pointers.
In C++ there are destructors which is like a function used to free any memory created during the program execution.
Java’s garbage collector takes care of the freeing of memory, the programmer don’t need to worry about it.