0
点赞
收藏
分享

微信扫一扫

Java中常量池、运行时常量池和字符串常量池的区别

程序员伟杰 2022-02-20 阅读 85

文章目录

一、字符串常量池

在这里插入图片描述

二、常量池与运行时常量池

public class T01_ConstantPool {
    public static void main(String[] args) {
  
    }
}
Constant pool:
   #1 = Methodref          #3.#17         // java/lang/Object."<init>":()V
   #2 = Class              #18            // T01_Pool
   #3 = Class              #19            // java/lang/Object
   #4 = Utf8               <init>
   #5 = Utf8               ()V
   #6 = Utf8               Code
   #7 = Utf8               LineNumberTable
   #8 = Utf8               LocalVariableTable
   #9 = Utf8               this
  #10 = Utf8               T01_ConstantPool;
  #11 = Utf8               main
  #12 = Utf8               ([Ljava/lang/String;)V
  #13 = Utf8               args
  #14 = Utf8               [Ljava/lang/String;
  #15 = Utf8               SourceFile
  #16 = Utf8               T01_ConstantPool.java
  #17 = NameAndType        #4:#5          // "<init>":()V
  #18 = Utf8               T01_Pool
  #19 = Utf8               java/lang/Object
举报

相关推荐

0 条评论