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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.