How Java differs from C and C++
Although Java was modeled on C and C++ languages, it differs from C and C++ in many aspects.Java does include a number of available in C and C++ as they were considered problematic.Here are some differences between Java and C.
Java and C
Java resembles C heavily but the main difference is that Java is an Object Oriented language which uses classes and objects.
➤Java does not include unique statement keywords sizeof and typedef.
➤Java does not have the data types structure and union.
➤Java do not defines the type modifiers keywords auto, extern, register,signed and unsigned.
➤Java does not have pointers.
➤Java does not have a preprocessor,hence #define,#include and #ifdef cannot be used.
➤In Java, functions with no arguments must be declared with empty parenthesis and not with the void like in C.
➤Java adds new operators also like instanceof and >>>.
➤Java has labelled break and continue statements.
➤Other features required for implementation of Object Oriented programming.
Java and C++
➤Java does not support operator overloading.
➤Java does not have template class.
➤Java does not implement multiple inheritance directly to tackle excessive complexity.This is achieved by interfaces in java.
➤Java does not support the concept of global variable.Everything must be wrapped inside classes.
➤Java does not use pointers.
➤There are no header files in Java.
No comments:
Post a Comment