Java Vs C++
- Java does not support pointers.Pointer are inherently tricky to use and troublesome.
- Java does not support multiple Inheritances because it causes more problem than it solves.Instead Java supports multiple interface inheritance,which allows an objects must implement those method signature from different interfaces with the condition that the inheriting object must implement those inherited methods.The multiple interface inheritance also allows an object to behave polymorphically on those methods.
- Java does not support destructors but adds a finalize() method.Finalize methods are invoked by the garbage collector prior to reclaiming the memory occupied by the object,which has the finalize() method.
- Java does not include structures or unions because the traditional data structures are implemented as an object oriented framework.
- All the code in Java Program is encapsulated within classes therefore Java does not have global variables or functions.
- c++ requires explicit memory management,while java include automatic garbage collection.