0

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?

4

1 回答 1

1

是的,正如它所说的那样an instance of java.lang.Class是创建的。这意味着代表类文件的对象被放置在堆上,以及Class方法区域中的文件。

这是Class调用 Object 时返回getClass()的对象。

于 2012-04-18T13:16:26.837 回答