标题: 今晚就这点吧 [打印本页] 作者: 0819邓商羽 时间: 2015-9-13 22:13 标题: 今晚就这点吧 30. 已知:
class B {
int i;
B(int i) {
this.i = i;
}
}
class C extends B {
public static void main(String[] args) {
C c = new C(1);
System.out.println(c.i);
}
}
的输出为
(A)0
(B)1
(C)编译错误
(D)运行时错误
31. 已知:
class C {
int x;
String y;
public C() {
this( “1”);
System.out.print(“one “);
}
public C(String y) {
this(1, “2”);
System.out.print(“two “);
}
public C(int x, String y) {
this.x = x;
this.y = y;
System.out.print(“three “);
}
public static void main(String[] args) {
C c = new C();
System.out.println(c.x + ““ + c.y);
}
}
则输出为
(A)1 2 one two three
(B)1 2 three two one
(C)one two three 1 2
(D)three two one 1 2 作者: lijieping 时间: 2015-9-13 22:25
进来看看学习学习