final变量和普通变量到底有何区别?
public class Test {
public static void main(String[] args) {
String a = "hello2";
final String b = "hello";
String d = "hello";
String c = b + 2;
String e = d + 2;
System.out.println((a == c));
System.out.println((a == e));
}
}答案:
truefalse引用的网站:http://www.cnblogs.com/dolphin0520/p/3736238.html有点晕,有大神能解析一下吗?
|
|