T
tenxian
Can anyone give me a clarification about both?
tenxian said:Can anyone give me a clarification about both?
Patricia Shanahan said:a reference can be stored in a variable or field that does have a name.
Nitpick: A non-null reference is a pointer to an object.
public class MyNamedObject {Lew said:Variables (sometimes) have names; objects don't.
Variables (sometimes) have names; objects don't.
Can anyone give me a clarification about both?
(Referencing: What is the difference between a name of an object and a
reference to an object?)
In Java, objects do not have names. A reference is a pointer to an object.
tenxian said:Objects in Java do not have names. Only classes in Java have names. So
if we want to mention an object, what can we do? To mention its
reference? Why can't we consider its reference as its name?
I can't
tell the difference between an object's name and its reference.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.