Question 34 / 297:  What is the expected output of compiling and running the following code?
import java.io.IOException;

class AirPlane {

public AirPlane() throws IOException, RuntimeException {

System.out.println("AirPlane");

}

}

class AirJet extends AirPlane { } // line 7

public class Tester {

public static void main(String args[]) throws IOException { // line 10

new AirPlane(); // line 11

}

}

A  AirPlane
B  Compile error at line 7, AirJet must declare a constructor that throws IOException or any of
its supertypes
C  Compile error at line 10, main() must throw also RuntimeException
D  Compile error at line 11 ,new AirPlane() must be within try/catch block
<< First < Previous Next > Last >>
Explanation:

If the Super class provides a constructor that throws a checked exception, then the sub classes must define an explicit constructor that also throws the same exception or one of its super types. For example class AirJet must declare a constructor like this

AirJet(int x) throws IOException{...}

Exam Home Page
Ask
Madison Christian
Start Test
Copy and paste the following HTML code into your website or blog.
<iframe src="https://www.jobilize.com/embed/java-certification-questions" width="600" height="600" frameborder="0" marginwidth="0" marginheight="0" scrolling="yes" style="border:1px solid #CCC; border-width:1px 1px 0; margin-bottom:5px" allowfullscreen webkitallowfullscreen mozallowfullscreen> </iframe>