c++ and java difference
- java does not support pointers because these are tricky to use and troublesome
- java does not support multiple inheritance because it cause more problem the it solve.
- instead of theses it support multiple interface inheritance, which allows an object to inherit many method signature from different interfaces with condition that the inheriting object must implement those inherited methods.
- java doesn't support destruction 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. this means you do not know when the object are going to be finalized.
- avoid using finalize() method to release non memory resource like file handles, sockets, database connections etc. because java has only a finite number of these resource and you do not know when the garbage collection is going to kick into release these resources through the finalize method
- java does not include structure or unions because the traditional data structures are implemented as an object oriented framework