简体   繁体   中英

java virtual machine: type information

I recently read about JVM specification according to Artima Inside the JVM 2-nd Ed. One of the chapters mentioned type storing in the Java runtime and it said that:

An instance of class java.lang.Class is created by the Java virtual machine for every type it loads. The virtual machine must in some way associate a reference to the Class instance for a type with the type's data in the method area.

I am a little bit confused, as I always thought that Class files where places on the method area that contained type information. Is there some other place that Java stores type info?

Yes, as it says an instance of java.lang.Class is created. This means an Object representing the class file is placed on the heap, as well as the Class file in the method area.

This is the Class object that is returned when you call getClass() on an Object.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM