S.NO
|
C
|
C++
|
JAVA
|
1.
|
Structured
programming language
|
Object-oriented
programming language
|
Object-oriented
programming language
|
2.
|
Compiled
|
Compiled
|
Compiled and
interpreted
|
3.
|
32 keywords
Eg:- case, char
|
60 keywords
Eg:- class,
protected
|
50 keywords
Eg:- interface,
extends
|
4.
|
Rules for naming
identifier
1. Should begin with alphabet
2. Can have numbers,underscore
3. Keywords cannot used as
identifiers
|
Rules for naming
identifier
1. Should begin with alphabet
2. Can have numbers,underscore
3. Keywords cannot used as
identifiers
|
Rules for naming
identifier
1. Can begin with alphabet, underscore or dollar
symbol. But cannot begin with a number
2. Keywords cannot used as
identifiers
|
5.
|
Comments:- /*….*/
(multi line comment), //(single line
comment)
|
Comments:- /*….*/
(multi line comment), //(single line
comment)
|
Comments:- /*….*/
(multi line comment), //(single line
comment), /** …. */(documentation comment)
|
6.
|
Data types :-
int,char,float,double,void
|
Data types :-
int,char,float,double,void
|
Data types:-
byte,short,int,long,
float,double,
char,boolean
|
7.
|
Bitwise shift
operators are : >>(right shift),<<(left shift)
|
Bitwise shift
operators are : >>(right shift),<<(left shift)
|
Bitwise shift
operators are : >>(right shift),<<(left
shift),>>>(triple right shift operator)
|
8.
|
Char is 8 bits
wide
|
Char is 8 bits
wide
|
Java uses Unicode
to represent characters. It is 16 bits wide.
|
9.
|
Preprocessor
directives allowed
Eg:-
#include,#define
|
Preprocessor
directives allowed
Eg:-
#include,#define
|
No preprocessor
directives
|
10.
|
Variables need
not be initialized before using it
|
Variables need
not be initialized before using it
|
Variables must be
initialized before using it
|
11.
|
Array should be
declared mentioning its size
Eg:- int num[10];
|
Array should be
declared mentioning its size
Eg:- int num[10];
|
Arrays are
declared without mentioning its size.
int num[];
num=new int[10] (or)
int num[]=new
int[10];
|
12.
|
Explicit string
data type not available
|
Explicit string
data type not available
|
String data type
available in java. It is a class
|
13.
|
Supports pointers
|
Supports pointers
|
Does not support
pointers
|
14.
|
Structures and
unions available
|
Structures and
unions available
|
Structures and
unions not available
|
15.
|
-
|
Supports operator
overloading
|
Does not support
operator overloading
|
16.
|
-
|
Programs can be
written in c++ without using a class
|
All the code in
java program needs to be written in one or more classes
|
17.
|
Global variables
and functions are allowed
|
Global variables
and functions are allowed
|
No global
variables or functions
|
18.
|
-
|
Allows default
arguments in functions
|
Not allowed in
java
|
19.
|
-
|
Supports multiple
inheritance
|
Multiple
inheritance not supported
|
20.
|
-
|
Supports
constructors and destructors
|
Supports constructors,
no destructors
|
21.
|
Supports typedef
|
Supports typedef
|
Does not support
typedef
|
22.
|
Unsigned integers
can be declared
|
Unsigned integers
can be declared
|
No unsigned
integers
|
23.
|
Allows goto
|
Allows goto
|
Does not allow
goto
|
24.
|
-
|
delete operator
available
|
No delete
operator
|
25.
|
-
|
Objects may be
passed by value or by reference
|
Objects are
passed by reference only in Java
|