This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes Diff b/w ref variable & object ref Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Diff b/w ref variable & object ref" Watch "Diff b/w ref variable & object ref" New topic
Author

Diff b/w ref variable & object ref

khateeb syed
Greenhorn

Joined: Jun 25, 2005
Posts: 9
Hello,

I would like to know the difference between Object reference & Reference variable.

What i understand is that an Object reference is a variable storing the address of the object in the memory like
Dimension d = new Dimension();//here d is an object ref( can this also be called as ref variable)

Now,
Dimension d; // now can we call the d as reference variable of type Dimension

plz let me know if i'm goin wrong anywhere.

Thanks.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

"d" in your examples is always a reference variable. In your first case, it's a reference variable containing an object reference. In your second case, it's a reference variable that's not holding an object reference yet.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Diff b/w ref variable & object ref