String str1="abc";
Class cls1 = str1.getClass();
Class cls2 = String.class;
Class cls3 = Class.forName("java.lang.String");
String str2 = "bcd";
Class cls4= str2.getClass();
System.out.println(cls1==cls2);
System.out.println(cls1==cls3);
System.out.println(cls1==cls4);
System.out.println(cls2==cls4);
结果:true true true true
为什么str1的类文件和str2的类文件是相同的???
|