What Is The Difference Between C++ And Java?
Question:What is the difference between C++ and Java?
-> Java does not support pointers. Pointers are inherently tricky to use and troublesome.-> Java does not support multiple inheritances because it causes more problems than it solves. Instead Javasupports multiple interface inheritance, which allows an object to inherit many method signatures fromdifferent interfaces with the condition that the inheriting object must implement those inherited methods. Themultiple 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 garbagecollector prior to reclaiming the memory occupied by the object, which has the finalize() method. This meansyou do not know when the objects are going to be finalized. Avoid using finalize() method to release nonmemoryresources like file handles, sockets, database connections etc because Java has only a finitenumber of these resources and you do not know when the garbage collection is going to kick in to releasethese resources through the finalize() method.-->Java does not include structures or unions because the traditional data structures are implemented as anobject oriented framework --> All the code in Java program is encapsulated within classes therefore Java does not have global variables orfunctions.--> C++ requires explicit memory management, while Java includes automatic garbage collection.
2009-2016 downloadmela.com. All rights reserved.