Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I think the <code>cleverly</code> part relates to the fact that a reference type is typically called a <code>pointer</code>, which necessitates the reader to learn two terms. The JVM terminology simply uses the term <code>reference</code> for this.</p> <p>There's also a historical context.</p> <p>When Java was introduced, its biggest competitor was C++. C++'s main problem was that it was deemed to be too difficult. Java initially positioned itself as the <em>easy alternative</em> to C++. It had a syntax very close to C++, but all the difficult stuff (operator overloading, templates, multiple pass-by mechanisms) etc were removed from the language.</p> <p>And now comes the catch...</p> <p>Java was initially marketed as <strong>not having pointers</strong>. The rationale for saying this was that pointers were deemed the most difficult thing of C++, so if Java would not have them, it had to be a simpler language.</p> <p>The <em>clever</em> part thus comes from simply inventing another term for 'pointer'. Call them reference and you can state Java does not have pointers (but references).</p> <p>This has lead to many debates and caused a good amount of confusion, especially since C++ already had the term 'reference' and uses it for something else (though conceptually a little related). The debate usually centers around two camps where one of them claims Java indeed does not have pointers, since you can't do pointer arithmetic with them and they don't directly represent memory addresses, while the other camp states that you don't have to be able to do arithmetic with a pointer to call it a pointer.</p> <p>Put differently, whether it was <em>clever</em> to use the term <code>reference</code> is still open for debate.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload