java学习小记
包含final方法的类是可以被继承的,但是定义为final的类不能被继承
静态变量由上往下执行,静态类和静态方法在被用到时才加载
"不考虑上下文,以下创建了几个对象?并且指出输出结果
String s1 = new String(""abc"");
String s2 = new String(""abc""); 三个对象:“s1” “s2” “abc”
if(s1== s2)
{
System.out.println(""s1,s2 refer to the same object"");
}
A. 2; ""s1,s2 refer to the same object""
B. 3; 无输出
C. 4; ""s1,s2 refer to the same object""
D. 5; 无输出 "