Isn't JVM smart itself to read the .class files and then execute them.
When the class (ie MyAccount.class file) is "loaded" , a java class of type "java.lang.Class" is created and that is used by JVM for executing the MyAccount.class. Why is this java.lang.Class required. I could not understand the reason.
What do we mean by "making it available". Does it mean that the class bytecode is provided to JVM to execute.
Isn't JVM smart itself to read the .class files and then execute them.
Yes it is - thanks to ClassLoaders :-)
Not quite: an object of type MyAccount.class is created, through which the actual objects (of type MyAccount) are instantiated and managed. Note the difference between an instance of MyAccount.class and an instance of MyAccount.
Pankaj Kumarkk wrote:
Isn't JVM smart itself to read the .class files and then execute them.
Yes it is - thanks to ClassLoaders :-)
I didn't understand still the term "loading the class". What does it mean. An elaborate answer will greatly help me understand the concept.
Not quite: an object of type MyAccount.class is created, through which the actual objects (of type MyAccount) are instantiated and managed. Note the difference between an instance of MyAccount.class and an instance of MyAccount.
I didn't understand the above 2 lines. Can you please elaborate.
I read somewhere that when a class is loaded then the classloader creates a object of type "java.lang.Class". Isn't it true. Then what is the purpose of this java.lang.Class object.
Thanks for the help
Regards
Prince
---------------------------------------------------------
SCJP 6 , still a life long learner
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |