单项选择题
class Parser extends Utils {
public static void main(String [] args) {
System.out.print(new Parser().getInt("42"));
}
int getInt(String arg) {
return Integer.parseInt(arg);
}
}
class Utils {
int getInt(String arg) throws Exception { return 42; }
}
结果为:()
A.42
B.编译失败
C.无输出结果
D.运行时异常被抛出
点击查看答案&解析
相关考题
-
单项选择题
class Top { static int x = 1; public Top(int y) { x *= 3; } } class Middle extends Top { public Middle() { x += 1; } public static void main(String [] args) { Middle m = new Middle(); System.out.println(x); } } 结果为:()
A.1
B.2
C.3
D.编译失败 -
单项选择题
t 是一个合法的 Thread 对象的引用,并且 t 的合法 run() 方法如下: public void run() { System.out.print("go "); } 及: t.start(); t.start(); t.run(); 哪一个是结果?()
A.go
B.go go
C.go go go
D.go 之后跟着一个异常 -
单项选择题
以下哪个类与SwingGUI菜单类无关?()
A.JMenu
B.JMenuBar
C.JMenuItem
D.以上皆是
