Java String之迷惑
程序员文章站
2022-06-06 09:46:07
...
package com.bobo;
public class Test {
/**
* @param args
*/
public final String a;
public final String a1 = "a";
public Test() {
a = "a";
}
public static void main(String[] args) {
new Test().testA();
}
public void testA() {
String b = a + "b";
String b1 = a1 + "b";
String c = "ab";
System.out.println(c == b);//false
System.out.println(c == b1);//true
}
}
public class Test {
/**
* @param args
*/
public final String a;
public final String a1 = "a";
public Test() {
a = "a";
}
public static void main(String[] args) {
new Test().testA();
}
public void testA() {
String b = a + "b";
String b1 = a1 + "b";
String c = "ab";
System.out.println(c == b);//false
System.out.println(c == b1);//true
}
}
上一篇: 女性内裤小警报 中医药膳可根除
下一篇: python数据结构之冒泡排序