Roshan
Posts: 3
Nickname: jrosh
Registered: May, 2002
|
|
Re: the Class class
|
Posted: May 4, 2002 11:11 AM
|
|
hi again,
Thank you for your reply. But I am still confused with CLASS. The following section is extraced from your book "Thinking in Java " ,Chapter 12 ,Run-Time Type Identification.
" There?s a Class object for each class that is part of your program. That is, each time you write and compile a new class, a single Class object is also created (and stored, appropriately enough, in an identically named .class file). At run-time, when you want to make an object of that class, the Java Virtual Machine (JVM) that?s executing your program first checks to see if the Class object for that type is loaded. If not, the JVM loads it by finding the .class file with that name. "
According to this the .class files that are produced by compiling the .java files are Objects of Type 'Class ', and that each time the JVM loads a class it loads this Class object.
I thought that the .class file represents a set of instructions (together with data) to the JVM. It is like an .exe file in windows, and what the JVM does is load the .class file and execute the instrucitons (byte code instrucitons) appear in the .class file.
And my understanding of the 'Class' class was it is just there to be used by anyone who needs to play with a objects at runtime.
I would be pleased if you could get me out of this confusion. Thank you !
|
|