You are on page 1of 3

Difference based on features of C++ which are

excluded from JAVA


C++
1) Pointers are strength of C++ language

2) In C++ structure and union are used.

JAVA
1) But in java pointers are omitted
because of security reasons . With the
help of pointers we are able to access
the address outside the program code
and data area thats why pointers are
not included in java
2) In java there is no concept of
structure and union because all can
be done with the help of classes

3)Operator overloading is included in C++


to provide flexibility of using expressions
with the user defined data types.

3) Operator overloading concept is


omitted in java because java
designers thought that it is used to
produce ambiguous conditions.

4) In C++ pre processor directories are


used like include, define etc.

4) In Java no preprocessor are used.


There are only packages and
interfaces are used.

5) In C++ global variable and global


functions are used which are defined
outside the class.

5) In Java everything is contained with


one or more classes so there is no
concept of global variable or global
functions.

6) In C++ we can derive one sub class from


more than one super class. (multiple
inheritance)

6) In Java in order to avoid complexities


we cant derive one subclass from
more that one super class.

7) In C++ there is a keyword typedef

7) There is no such keyword like


typedef in java.

8) In C++ goto statements are used to


transfer the control from one part of
program to the other.

8) In java no goto statement is used.

9)In C++ unsigned int are used

9) In java int cant be unsigned.

Differences based on features which are


unique to java
C++
1 ) There is no scope for multithreading

2) In C++ there is no concept of packages.

3) In C++ there is no concept of interface


But the concept of abstract classes is the
close similarity to that of interfaces in java
4) In C++ standard library are used to
define the commonly used functions.
5) In C++ break and continue statements
are used to put the control outside the loop
in which these statements are used.

JAVA
1) But in java 2 or more programs can
be executed concurrently which is
unique to java and java runtime
system provides the thread class to
implement the concept of
multithreading
2) Package is the main feature of java
which are used to store the files
under one directly.
3) In java interfaces are used to
declare and define the related class
which can be implemented by the
other classes.
4) But in java there is no concept of
standard libraries only the classes
define in the interfaces are used.
5) In java break and continue
statements are extended in levels
that can be used as targets . It is use
to transfer the control back with in
the loop

Differences based on features that are


common to C++ and JAVA but different in use
C++

JAVA

1) In C++ the Boolean data type is used but


any non zero value is considered to be true
and 0 is false.

1) But in Java the true and false value are


pre defined literals

2) In C++ the access specifiers are applied


to a group of statements.

2) But in java these access specifiers are


applied only to a single statement.

3) In C++ exceptional handling is used to

3) But in Java the thrown exception must

avoid the run time errors and it is not


necessary that the thrown exception must
be caught.

be caught.

4) In C++ modulus operator can find out


the remainder of integer values only

4) In Java modulus operator is more


intelligent to accept the real values as well
as integer values as operand.

5) In C++ by default the data and functions


are private.

5) By default the data members and


functions of class are public.

You might also like