By rick
via tech-tonic.net
Published: Oct 04 2006 / 14:55
It’s a common misconception that Java has no pointers. It’s not exactly true. Java has pointers, they’re just not explicit. Every object is a reference to a location making it a pointer… you just can’t manipulate the pointers directly.
Comments
stevechaloner replied ago:
Any Java developer who didn't realise Java has pointers has clearly never thought deeply about why NullPointerException is named as it is!
Ricky Clarkson replied ago:
There are two widely-used meanings of pointers.
1. Things that hold an address of something else.
2. The same as 1., but where you can point at arbitrary addresses, not just addresses where there are useful/known things.
The 2nd definition is usually used by people who have seen pointers as in C, but haven't understood that pointers aren't dependent on pointer arithmetic.
Just as I can know roman numerals without knowing how to add them, pointers can exist without pointer arithmetic.
cbegin replied ago:
Yep. A lot of people don't realize Java uses pass-by-value semantics too... ;-)
debedb replied ago:
Indeed! I've actually had people ask me whether Java is pass-by-value or by reference, and having strange misconceptions...
I've enjoyed explaining it...
Voters For This Link (10)
Voters Against This Link (0)