About Question enthuware.ocajp.i.v7.2.839 :
Posted: Mon Apr 09, 2012 8:23 am
Look at this question:
It asks for an option that allows the code to compile. The option Change doStuff in Amazing to throw only IllegalArgumentException., is correct in this point of view, but Change doStuff in Great to throw only IOException instead of FileNotFoundException. is also correct.
So this question is a little ambiguous.
Code: Select all
How can you fix the following code to make it compile:
class Great {
public void doStuff() throws FileNotFoundException{
}
}
class Amazing extends Great {
public void doStuff() throws IOException, IllegalArgumentException{
}
}
public class TestClass {
public static void main(String[] args) throws IOException{
Great g = new Amazing();
g.doStuff();
}
}
So this question is a little ambiguous.