By the way C++ is also an object-oriented programming language, just like Java. But there are some important feature wise difference, between C++ and Java
Below are Difference between C++ and Java
- C++ is not purely object-oriented programming language, Since it is possible to to write C++ program without using a class or an object. Java is puerly an object-oriented programming language, Since it is not possible to write a Java Program without using at least one class.
- Pointers are available in C++ We cannot create and use pointer in Java
- De-Allocating memory is the responsibility of the programmer. De-Allocating memory is the responsibility of the JVM.
- C++ has goto statement. Java does not have goto statement.
- Automatic casting is available in C++. In some cases, implicit casting is available but it is advisable that the programmer should use casting whenever required.
- Multiple inheritance feature is available in C++. Multiple inheritance is not available in Java classes but possible with interface.
- There are 3 access specifiers in C++ private, public and protected. Java supports 4 access specifiers private, public, protected and default.
- There are constructor and destructor in C++. Only constructor are there in java, No destructor are available.