Difference Between JAVA and C++
» Java is platform independent while C++ is not.Platform independent means it can be implemented and operated on various platforms without any compatibility problem.
» Output of Java code is bytecode while in C++ it is executable file.
When we compile any JAVA program then an output file is generated which has .class extension, this file is called bytecode. While when we compile C++ file then an executable file is generated which has .exe extension
» Java does not support Pointer while C++ supports.
Because java provides a secure platform and use of pointers in any language makes it insecure by various means.
» Java does not support Structure and Union while C++ supports
These were felt to be redundant since the class encompasses them.
» Java does not support operator overloading while C++ supports.
Operator overloading causes ambiguity in programs that’s why JAVA does not support this
» Java only supports Constructor not Destructor
However you can implement destructor using finalize( ) function
» JAVA does not allow Default Arguments while C++ allows
A default argument is an argument to a function that is not required to specify when calling the function because it is already specified by the programmer in function declaration.
» Java does not support multiple inheritance while C++ supports it
However in JAVA “Multiple Inheritance” can be implemented by multi-level and hierarchical inheritance.
» In JAVA objects can be passed by reference only while C++ supports both (Pass by Reference and Pass by Value)
» Java does not support typedef
» Java does not allow the goto statement.
» Java does not support the delete operator.
» Java does not perform any automatic type conversions.
Comments