How JVM processes classes?

Discussion in 'Java' started by abhishekshahi, Jun 5, 2007.

  1. abhishekshahi

    abhishekshahi New Member

    Joined:
    Jun 5, 2007
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Software Professional
    Location:
    New Delhi,India
    Question : Instances of the class "Class" represent classes and interfaces in a running Java application. does that mean whenever there is class or interface in a java application there will be an instance of class "Class" and if it is true then does it implies that our classes , interfaces ,object are all handled by JVM through their respective instances of class "Class".

    Answer : java.lang.Class represent classes and interfaces in running java application, it means that there will be an instance of java.lang.Class class always. i.e. For every type a Java Virtual Machine loads, it creates an instance of class java.lang.Class to represent that type. And like all objects, ClassLoader objects and instances of Class class reside on the heap and data for loaded types reside in method area.



    If JVM is loading a class and there is super class being refered or, instance of other class is being used inside it, then JVM uses Class object otherwise JVM uses object of its type to perform any custom operation on it.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice