aspose file tools*
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
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: 24187
    
  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