0
import java.io.*;

public class Mac extends Laptop {
    public static void main(String r[]) {
        new Mac().crunch();
        }
    //insert code here
}

class Laptop {
    void crunch() throws IOException { }
}

The question is simple. Insert a code that will make the program compile.

Answers are:
void crunch() or void crunch() throws RuntimeException {}

Then a note was given for an incorrect option that void crunch() throws FileNotFoundException {} would be correct if crunch() invocation on line 5 was either handled or declared.

Doubt: I understood the correct options. I did not understand how the invocation has to be handled or declared? Could someone please complete the code of that handling or declaring part to illustrate it.

Thanks.

Edited by rahul.ch

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by NormR1
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.