The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
August 2000

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Object reference

Posted by cannyq on September 26, 2000 at 10:43 PM

> When we make a class reference variable by writing say
> "graphics g" then what actually goes in "g" , prototypes of all the methods + address of class "graphics" or just the prototypes of all the methods found in the "graphics class" .

> Secondly when we make an object reference by writing say
> "A obj1=new A()" then what actually goes in "obj1" , Address of the class copy made in memory + prototypes of all the methods in that copy or just the address of that copy of class .

First of all, if class A is not loaded, the JVM will load try to find, load, link, and initialize it.

After that, obj1 will contain a Class instance pointing the memory block where A was loaded. This will be the place where obj1 goes to get the its declared methods. It would contain a copy of all the local variables and that of its parents. It would also contain a Method Table of direct references to its methods for quick future access.





Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us