Why pointers are not used in java programming




















This is good feature of pointers but sometimes it causes headache for programmers to manage memory manually. As java provides the automatic garbage collection feature so there is no need of pointers and it makes memory management easier. Java has the concept of reference which is more simple and secure than pointer. Thanks for creating this useful website. Pointers are optional.

They however give you lots of power. You can literally never use them,,, but sometimes they are of great need. I like Pointers and pointer arithmetic are relatively hard to understand for people especially if you get to multiple levels of pointers: pointers to pointers, etc. Besides that, not having pointers makes it possible to have garbage collection in Java. Because the JVM controls and manages where objects are in memory, the garbage collector has more freedom to move objects around in memory.

Campbell Ritchie: it is not quote. Henry Wong. So, how did you explain that it is related to the polymorphism concept in Java? Henry Wong: I explained based on run-time polymorphism using method overriding in java. Base class reference variable can refer to subclass objects and can access methods from any class. This I used to explain. Interview questions count as quotes. Article Contributed By :. Easy Normal Medium Hard Expert.

Writing code in comment? Please use ide. Load Comments. What's New. Most popular in Java. More related articles in Java. We use cookies to ensure you have the best browsing experience on our website. This is in general equivalent to changing a field in an object scope that both the caller and callee can see. Manual memory management: you can use pointers to manually control and allocate blocks of memory. This is useful for some bigger applications like games, device drivers etc.

Java instead provides very good automatic Garbage Collection GC which takes care of memory management. Home C VB. Why pointer concept not use in java? Some reasons for Java does not support Pointers: 1. Next : What is package in Java? What gives Java its 'write once and run anywhere' nature? What is JVM and is it platform independent? What is the garbage collector in Java?

What is numeric promotion? Why do we need Generic Types in Java? What does it mean to be static in Java?



0コメント

  • 1000 / 1000