Sunday, 22 January 2017

DIFFERENCE BETWEEN C++ AND JAVA

C++
JAVA
C++ is not a purely object-oriented programming language, since it is possible to write C++ programs without using a class or an object.

Java is purely 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 can not create and use pointers in java.

De-allocating memory is the responsibility of the programmer.

De-allocation of memory will be taken care by jvm.
Automatic casting is available in C++

In some cases, implicit casting is available but it is advisable that the programmer should use casting wherever required.

Multiple inheritance feature is available in C++

Multiple inheritance is not available in java with classes but possible with interface.

C++ has goto statement

Java does not have goto statements.
There are 3 access specifiers in C++ private, public and protected.

Java supports 4 access specifiers private, public, protected and default.

There are constructors and destructors in C++

Only constructors are there in java, no destructors are available.

No comments:

Post a Comment