JAVA题库:考考你2
添加时间: 2007-9-22 6:17:42 作者: JAVA认证考试 阅读次数:277 来源: http://www.d9soft.com
What will happen when you attempt to compile and run the following code?
class Base
{
int i = 99;
public void amethod()
{
System.out.println("Base.amethod()");
}
Base()
{
amethod();
}
}
public class Derived extends Base
{
int i = -1;
public static void main(String argv[])
{
Base b = new Derived();
System.out.println(b.i);
b.amethod();
}
public void amethod()
{
System.out.println("Derived.amethod()");
}
}
A. Derived.amethod()
-1
Derived.amethod()
B. Derived.amethod()
99
Derived.amethod()
C. 99
Derived.amethod()
D.
Compile time error答案:B
上一篇文章: SCJP认证套题解析卷1 下一篇文章: JAVA题库:考考你4
相关文章:

