Java is a true object-oriented language while C++ is basically C with object-oriented extension. That is what exactly the increment operator + + indicates. C+ + has maintained backward compatibility with C. It is therefore possible to write an old style C program and run it successfully under C++. Java appears to be similar to C++ when we consider only the "extension" part of C++. However, some object-oriented features of C++ make the C++ code extremely difficult to follow and maintain.
Listed below are some major C++ features that were intentionally omitted from Java or significantly modified.
• 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 a class 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.
0 comments:
Post a Comment