i hope this / those problems doesn't occur.
It is question 29 of 2nd practice exam:
Given that:
Exception is the superclass of IOException, and
IOException is the superclass of FileNotFoundException, and
3. import java.io.*;
4. class Physicist {
5. void think() throws IOException { }
6. }
7. public class Feynman extends Physicist {
8. public static void main(String[] args) {
9. new Feynman().think();
10. }
11. // insert method here
12. }
Which of the following methods, inserted independently at line 11, compiles? (Choose all
that apply.)
A. void think() throws Exception { }
B. void think() throws FileNotFoundException { }
C. public void think() { }
D. protected void think() throws IOException { }
E. private void think() throws IOException { }
F. void think() { int x = 7/0; }
Answer:
B, C, D, and F are correct....
My answer was / would be C and F - because the method call "new Feynman().think();" doesn't declares or handles an exception. So B and D do cause an compile error. What do you think?