Evo. G Tech Team Forum
Welcome to Evo. G Tech Team Forum. We have moved to a new website : www.evogtechteam.com

Thanks you.

by Evo. G Tech Team Management.

How Java differs from C and C++

View previous topic View next topic Go down

How Java differs from C and C++

Post by too wei on August 19th 2015, 23:12

How Java Differs From C
Java is not lot like C but the major difference between Java and C is that Java is and object-oriented language and has mechanism to define classes and objects. 
In an effort to build a simple and safe language, the Java team did not include some of the C features in Java.

-Java does not include the C unique statement keywords sizeof, 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

How Java Differs From C++
Java is a true object-oriented language while C++ is basically C with object-oriented extension. C++ has maintained backward compatibility with C.
Java appears to be similar to C++ when we consider only the “extensions” part of C++.

-Java does not support operator overloading.
-Java does not have template classes as in C++
-Java does not support multiple inheritance 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

too wei

Posts : 31
Points : 20271
Reputation : 0
Join date : 2015-04-21
Age : 19
Location : Johor

View user profile

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

Permissions in this forum:
You cannot reply to topics in this forum