你所有的
class,
interface,
field名称和
string常量进入java的 常量池 。
根据VM规范(http://java.sun.com/docs/books/jvms/second_edition/html/ClassFile.doc.html):
constant_pool是一个结构表(第4.4节),表示各种字符串常量,类和接口名称,字段名称以及在ClassFile结构及其子结构中引用的其他常量。每个constant_pool表条目的格式由其第一个“标签”字节指示。constant_pool表的索引从1到constant_pool_count-1。
因此,就常量池而言,可以将以下内容视为:
const #22 = String #23; // hello worldconst #23 = Asciz hello world;
#22(索引22)处的
String值是类型,其值为null终止的c字符串(Asciz)
helloworld位于索引23。



