String类-intern方法_数据String类-intern方法_字符串_02
 1 package cn.itcast.p1.string.demo;
 2 
 3 class StringObjectDemo {
 4     public static void main(String[] args) {
 5 //        String s1 = "abc";
 6 //        String s2 = "abc";
 7         
 8         //intern():对字符串池进行操作的
 9         
10         String s1 = new String("abc");
11         String s2 = s1.intern();//常量池
12         
13         System.out.println(s1==s2);//false
14     }
15 }
View Code