Results 1 to 3 of 3
  1. #1
    katie is offline Member
    Join Date
    Jul 2007
    Rep Power

    Default Object and reference

    what is the difference between Object and reference in JAVA, with respect to the memory .
    I know that object occupies the memory whereas the reference do not, only that
    can you guide me with more information ?
    thanks guys

  2. #2
    Jack is offline Senior Member
    Join Date
    Jun 2007
    Rep Power


    Object occupies a range of memory, say, from address n to m.

    Reference is a variable, may be 32 bit size, who has value n.
    Java Code:
    MyObject mo = new MyObject();
    If mo object is laid on memory from address n, then the reference mo's value would be n.

    Reference mo, a 32 bit data, itself may be put on address p.

  3. #3
    popjava is offline Member
    Join Date
    Oct 2009
    Rep Power

Similar Threads

  1. Replies: 2
    Last Post: 11-26-2010, 03:12 AM
  2. Replies: 1
    Last Post: 04-15-2008, 01:09 PM
  3. Replies: 0
    Last Post: 04-15-2008, 09:12 AM
  4. Getting the Object Reference Name
    By Deathmonger in forum New To Java
    Replies: 2
    Last Post: 03-12-2008, 03:51 PM
  5. reference to elements in array
    By Igor in forum New To Java
    Replies: 1
    Last Post: 12-14-2007, 12:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts