Java常量池详细说明
Posted duo-duo
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Java常量池详细说明相关的知识,希望对你有一定的参考价值。
java常量池技术
java中的常量池技术,是为了方便快捷地创建某些对象而出现的,当需要一个对象时,就可以从池中取一个出来(如果池中没有则创建一个),则在需要重复创建相等变量时节省了很多时间。常量池其实也就是一个内存空间,常量池存在于方法区中
Constant pool:
#1 = Methodref #32.#86 // java/lang/Object."<init>":()V
#2 = Fieldref #31.#87 // com/bookStore/commons/beans/User.id:Ljava/lang/Integer;
#3 = Fieldref #31.#88 // com/bookStore/commons/beans/User.username:Ljava/lang/String;
#4 = Fieldref #31.#89 // com/bookStore/commons/beans/User.password:Ljava/lang/String;
#5 = Fieldref #31.#90 // com/bookStore/commons/beans/User.gender:Ljava/lang/String;
#6 = Fieldref #31.#91 // com/bookStore/commons/beans/User.email:Ljava/lang/String;
#7 = Fieldref #31.#92 // com/bookStore/commons/beans/User.telephone:Ljava/lang/String;
#8 = Fieldref #31.#93 // com/bookStore/commons/beans/User.introduce:Ljava/lang/String;
#9 = Fieldref #31.#94 // com/bookStore/commons/beans/User.activeCode:Ljava/lang/String;
#10 = Fieldref #31.#95 // com/bookStore/commons/beans/User.state:I
#11 = Fieldref #31.#96 // com/bookStore/commons/beans/User.registTime:Ljava/util/Date;
#12 = Fieldref #31.#97 // com/bookStore/commons/beans/User.role:Ljava/lang/String;
#13 = Class #98 // java/lang/StringBuilder
#14 = Methodref #13.#86 // java/lang/StringBuilder."<init>":()V
#15 = String #99 // User{id=
#16 = Methodref #13.#100 // java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
#17 = Methodref #13.#101 // java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
#18 = String #102 // , username=\\‘
#19 = Methodref #13.#103 // java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
#20 = String #104 // , password=\\‘
#21 = String #105 // , gender=\\‘
#22 = String #106 // , email=\\‘
#23 = String #107 // , telephone=\\‘
#24 = String #108 // , introduce=\\‘
#25 = String #109 // , activeCode=\\‘
#26 = String #110 // , state=
#27 = Methodref #13.#111 // java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
#28 = String #112 // , role=\\‘
#29 = String #113 // , registTime=
#30 = Methodref #13.#114 // java/lang/StringBuilder.toString:()Ljava/lang/String;
#31 = Class #115 // com/bookStore/commons/beans/User
#32 = Class #116 // java/lang/Object
#33 = Utf8 id
#34 = Utf8 Ljava/lang/Integer;
#35 = Utf8 username
#36 = Utf8 Ljava/lang/String;
#37 = Utf8 password
#38 = Utf8 gender
#39 = Utf8 email
#40 = Utf8 telephone
#41 = Utf8 introduce
#42 = Utf8 activeCode
#43 = Utf8 state
#44 = Utf8 I
#45 = Utf8 role
#46 = Utf8 registTime
#47 = Utf8 Ljava/util/Date;
#48 = Utf8 <init>
#49 = Utf8 ()V
#50 = Utf8 Code
#51 = Utf8 LineNumberTable
#52 = Utf8 LocalVariableTable
#53 = Utf8 this
#54 = Utf8 Lcom/bookStore/commons/beans/User;
#55 = Utf8 getId
#56 = Utf8 ()Ljava/lang/Integer;
#57 = Utf8 setId
#58 = Utf8 (Ljava/lang/Integer;)V
#59 = Utf8 getUsername
#60 = Utf8 ()Ljava/lang/String;
#61 = Utf8 setUsername
#62 = Utf8 (Ljava/lang/String;)V
#63 = Utf8 getPassword
#64 = Utf8 setPassword
#65 = Utf8 getGender
#66 = Utf8 setGender
#67 = Utf8 getEmail
#68 = Utf8 setEmail
#69 = Utf8 getTelephone
#70 = Utf8 setTelephone
#71 = Utf8 getIntroduce
#72 = Utf8 setIntroduce
#73 = Utf8 getActiveCode
#74 = Utf8 setActiveCode
#75 = Utf8 getState
#76 = Utf8 ()I
#77 = Utf8 setState
#78 = Utf8 (I)V
#79 = Utf8 setRegistTime
#80 = Utf8 (Ljava/util/Date;)V
#81 = Utf8 getRole
#82 = Utf8 setRole
#83 = Utf8 toString
#84 = Utf8 SourceFile
#85 = Utf8 User.java
#86 = NameAndType #48:#49 // "<init>":()V
#87 = NameAndType #33:#34 // id:Ljava/lang/Integer;
#88 = NameAndType #35:#36 // username:Ljava/lang/String;
#89 = NameAndType #37:#36 // password:Ljava/lang/String;
#90 = NameAndType #38:#36 // gender:Ljava/lang/String;
#91 = NameAndType #39:#36 // email:Ljava/lang/String;
#92 = NameAndType #40:#36 // telephone:Ljava/lang/String;
#93 = NameAndType #41:#36 // introduce:Ljava/lang/String;
#94 = NameAndType #42:#36 // activeCode:Ljava/lang/String;
#95 = NameAndType #43:#44 // state:I
#96 = NameAndType #46:#47 // registTime:Ljava/util/Date;
#97 = NameAndType #45:#36 // role:Ljava/lang/String;
#98 = Utf8 java/lang/StringBuilder
#99 = Utf8 User{id=
#100 = NameAndType #117:#118 // append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
#101 = NameAndType #117:#119 // append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
#102 = Utf8 , username=\\‘
#103 = NameAndType #117:#120 // append:(C)Ljava/lang/StringBuilder;
#104 = Utf8 , password=\\‘
#105 = Utf8 , gender=\\‘
#106 = Utf8 , email=\\‘
#107 = Utf8 , telephone=\\‘
#108 = Utf8 , introduce=\\‘
#109 = Utf8 , activeCode=\\‘
#110 = Utf8 , state=
#111 = NameAndType #117:#121 // append:(I)Ljava/lang/StringBuilder;
#112 = Utf8 , role=\\‘
#113 = Utf8 , registTime=
#114 = NameAndType #83:#60 // toString:()Ljava/lang/String;
#115 = Utf8 com/bookStore/commons/beans/User
#116 = Utf8 java/lang/Object
#117 = Utf8 append
#118 = Utf8 (Ljava/lang/String;)Ljava/lang/StringBuilder;
#119 = Utf8 (Ljava/lang/Object;)Ljava/lang/StringBuilder;
#120 = Utf8 (C)Ljava/lang/StringBuilder;
#121 = Utf8 (I)Ljava/lang/StringBuilder;
以上是关于Java常量池详细说明的主要内容,如果未能解决你的问题,请参考以下文章