When and Where is the String initialised/stored in Java source code?

后端 未结 3 1683
梦毁少年i
梦毁少年i 2021-01-17 16:35

This is the source code I have:

public class Koray {
    public static void main(String [] args) {
            System.out.println(\"This is a sample program.         


        
3条回答
  •  独厮守ぢ
    2021-01-17 16:49

    See that ldc instruction? It loads a constant from the runtime constant pool. That's where the your string is stored. To print the constant pool as well, add -verbose option to javap call.

提交回复
热议问题