问一道 测试题 帮忙啊
import java.io.*;
class Master {
String doFileStuff() throws FileNotFoundException { return "a"; }
}
class Slave extends Master {
public static void main(String[] args) {
String s = null;
try {
s = new Slave().doFileStuff();
} catch ( Exception x) {
s = "b";
}
System.out.println(s);
}
// insert code here
}
Which, inserted independently at // insert code here, will compile,
and produce the output b? (Choose all that apply.)
A. String doFileStuff() { return "b"; }
B. String doFileStuff() throws IOException ( return "b"; }
C. String doFileStuff(int. x) throws IOException ( return "b"; }
D. String doFileStuff() throws FileNotFoundException { return "b"; }
E. String doFileStuff() throws NumberFormatException { return "b"; }
F. String doFileStuff() throws NumberFormatException, FileNotFoundException { return "b"; }
答案 给的是 A D E F
小弟 刚学 java 大侠们帮忙啊 B为什么不对啊 请大家帮忙啊 也希望有人 给的回答 详细点 让小弟 多学些知识谢谢啊 分不是很多 大家见谅啊 呵呵