Instructor of Java In-Depth Course on Udemy! · Updated 7y ·
When a class (say, Hello) is accessed for the very first time (e.g., say an instance of it is created ~ new Hello()), then class loader (a component of JVM) loads it (the bytecodes) and creates an instance of java.lang.Class that represents the class in context, i.e., Hello. Thereafter, when you are creating an object of that same class, this Class object would be used by JVM to create the object. This Class object is also the entry point to use reflection and it can also be used to get meta-information about the class like the class name, super-class name, etc. Hope that helps!
1.3K views ·
View upvotes
· 1 of 4 answers
Something went wrong. Wait a moment and try again.