forked from CPU-Code/java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStringConstant.java
More file actions
37 lines (33 loc) · 818 Bytes
/
Copy pathStringConstant.java
File metadata and controls
37 lines (33 loc) · 818 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* User: cpucode
* Date: 2021/1/9
* Time: 12:55
* Github: https://github.com/CPU-Code
* CSDN: https://blog.csdn.net/qq_44226094
*/
package com.cpucode.java.string.table;
/*
* 通过debug 查看 memory 的String类个数
* */
public class StringConstant {
public static void main(String[] args) {
//2148
System.out.println();
//2149
System.out.println("1");
System.out.println("2");
System.out.println("3");
System.out.println("4");
//2153
System.out.println("5");
//如下的字符串不会再次加载
//2154
System.out.println("1");
//2154
System.out.println("2");
System.out.println("3");
System.out.println("4");
//2154
System.out.println("5");
}
}