Difference between the Java and C language and C ++ language
How is Java different from C…
C Language
- Major difference is that C is a structure oriented language and
- Java is an object oriented language and has mechanism to define classes and objects.
- Java does not support pointer type.
- Java does not have preprocessor, so we cant use #define,#include and #ifdef statements.
- Java does not include structures, unions and enum data types.
- Java does not include keywords like goto, sizeof and type def.
- Java adds labeled break and continue statements.
- Java adds many features required for object oriented
programming.
C++ language
Features removed in java:- Java doesn’t support pointers to avoid unauthorized access
of memory locations. - Java does not include structures, unions and Enum data
types. - Java does not support operator over loading.
- Pre-processor plays less important role in C++ and so
eliminated entirely in java. - Java does not perform automatic type conversions that result in loss of precision.
- Java does not support global variables. Every method and variable is declared within a class
and forms part of that class. - Java does not support inheritance of multiple super classes by a sub class (i.e., multiple inheritance). This is accomplished by using ‘interface’ concept.
- It is not possible to declare unsigned integers(Unsigned can hold a larger positive
value, and no negative value. - In java objects are passed by reference only. In C++ objects may be passed by value or reference.
Comments
Post a Comment