You may have heard some FUDster claiming that Java sucks roadkill because it has no pointers. He jeers, How can you write serious code without pointers? In Java are you actually limited to FØRTRAN style problems: no linked lists, no queues etc? Java does not have raw pointers like C or C++. It has something almost as powerful, but many times safer called references (Java refers to them as pointers in one place, the NullPointerException). They are like pointers, except that the dangerous features are removed, namely:
So they decided to rename them references. But old habits die hard and people, even those at Sun, sometimes continued to call them pointers. The further wanted a new term that allowed for the many ways you can implement Java pointers e.g. via machine virtual RAM pointers, segmented pointers, 64-bit addressing pointers or handles. The word pointer leaked through in various places including NullPointerException.
Most studies agree that pointers are one of the primary features that enable programmers to inject bugs into their code. Given that structures are gone and arrays and strings are objects, the need for pointers to these constructs goes away. Thus, Java has no pointer data types. Any task that would require arrays, structures and pointers in C can be more easily and reliably performed by declaring objects and arrays of objects. Instead of complex pointer manipulation on array pointers, you access arrays by their arithmetic indices. The Java run-time system checks all array indexing to ensure indices are within the bounds of the array.You no longer have dangling pointers and trashing of memory because of incorrect pointers because there are no pointers in Java.
~ James Gosling (1955-05-18 age:62), co-inventor of Java, in a paper The Java Language Environment co-authored with Henry McGilton
An object is a class instance or an array.
The reference values (often just references) are pointers to these objects and a special null reference, which refers to no object.
~ James Gosling (1955-05-18 age:62), co-inventor of Java,
This page is posted |
http://mindprod.com/jgloss/pointer.html | |
Optional Replicator mirror
|
J:\mindprod\jgloss\pointer.html | |
Please read the feedback from other visitors,
or send your own feedback about the site. Contact Roedy. Please feel free to link to this page without explicit permission. | ||
Canadian
Mind
Products
IP:[65.110.21.43] Your face IP:[18.97.14.81] |
| |
Feedback |
You are visitor number | |