The document compares Java and C/C++. It states that Java does not include some keywords, data types, type modifiers, and features found in C like pointers, preprocessor directives, and void function declarations. It also notes Java adds new operators, labeled statements, and object-oriented features. Compared to C++, the document notes Java does not support operator overloading, templates, multiple inheritance or pointers, and replaces destructors with finalize().
Java lacks unique C keywords, struct, union, pointer types, and preprocessor. It has OOP features, new operators, and labeled statements, whereas C includes these capabilities.
Java does not support operator overloading, template classes, multiple inheritance, or global variables. It uses finalize() instead of destructors and has no header files, unlike C++.
Java and C
Javadoes not include the C unique statement keywords
size of and typedef.
Java does not contain the data type struct and union.
Java does not define the type modifiers keywords auto,
extern, register, signed, and unsigned.
Java does not support an explicit pointer type.
Java does not have a preprocessor and therefore we
cannot use # define, # include, and # ifdef statements.
Java requires that the functions with no arguments must
be declared with empty parenthesis and not with the void
keyword as done in C.
Java adds new operators such as instanceof and >>>.
Java adds labelled break and continue statements.
Java adds many features required for object-oriented
programming.
2.
C Programming JavaProgramming
It does include the unique statement keywords
sizeof, and typedef.
It does not include the C unique statement keywords
sizeof, and typedef.
It contain the data type struct and union. It does not contain the data type struct and union.
It define the type modifiers keywords auto,
extern, register, signed, and unsigned.
It does not define the type modifiers keywords auto,
extern, register, signed, and unsigned.
It supports an explicit pointer type. It does not support an explicit pointer type.
It has a preprocessor and therefore we can use
# define, # include, and # ifdef statements.
It does not have a preprocessor and therefore we
cannot use # define, # include, and # ifdef statements.
It requires that the functions with no
arguments, with the void keyword
It requires that the functions with no arguments must
be declared with empty parenthesis, not with the void
keyword
C has no operators such as instanceof and >>>. Java adds new operators such as instanceof and >>>.
C adds have a break and continue statements. Java adds labeled break and continue statements.
C has no object-oriented programming
features.
Java adds many features required for object-oriented
programming.
3.
Java and C++:
Java does not support operator overloading.
Java does not have template classes as in C++.
Java does not support multiple inheritances of classes.
This is accomplished using a new feature called
“Interface”.
Java does not support global variables. Every variable
and method is declared within classes and forms part of
that class.
Java does not use pointers.
Java has replaced the destructor function with a finalize()
function.
There are no header files in Java.
4.
C++ Programming JavaProgramming
It support operator overloading. It does not support operator overloading.
It support has template classes. It does not have template classes as in C++.
It supports multiple inheritances
of classes.
It does not support multiple inheritances of
classes. This is accomplished using a new
feature called “Interface”.
It supports global variables. It does not support global variables. Every
variable and method is declared within
classes and forms part of that class.
It supports pointers. It does not use pointers.
It does not support destructor
function with a finalize() function.
It has replaced the destructor function with a
finalize() function.
There are header files in Java. There are no header files in Java.