java常量池在哪里_Java常量池详细说明

java常量池技术

java中的常量池技术,是为了方便快捷地创建某些对象而出现的,当需要一个对象时,就可以从池中取一个出来(如果池中没有则创建一个),则在需要重复创建相等变量时节省了很多时间。常量池其实也就是一个内存空间,常量池存在于方法区中

3f1642d9890548df2051a8cbd448473a.png

Java是一种动态链接的语言,常量池的作用非常重要,常量池中除了包含代码中所定义的各种基本类型(如int、long等等)和对象型(如String及数组)的常量值外,还包含一些以文本形式出现的符号引用,比如:

类和接口的全限定名;

字段的名称和描述符;

方法的名称和描述符。

3ed6146861288db983c122de21eaa5c0.png

Constant pool:

#1 = Methodref#32.#86 // java/lang/Object."":()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."":()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

#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 // "":()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;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值