Link Details

Link 4127 thumbnail
User 1 avatar

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.
  • 10
  • 0
  • 825
  • 267

Comments

Add your comment
User 168888 avatar

stevechaloner replied ago:

1 votes Vote down Vote up Reply

Any Java developer who didn't realise Java has pointers has clearly never thought deeply about why NullPointerException is named as it is!

User 179375 avatar

Ricky Clarkson replied ago:

0 votes Vote down Vote up Reply

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.

User 205784 avatar

cbegin replied ago:

1 votes Vote down Vote up Reply


Yep. A lot of people don't realize Java uses pass-by-value semantics too... ;-)

User 202063 avatar

debedb replied ago:

0 votes Vote down Vote up Reply

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...

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (10)



Voters Against This Link (0)