1. Engineering
  2. Computer Science
  3. java netbeans project please show solution public class testclass ...

Question: java netbeans project please show solution public class testclass ...

Question details

Java NetBeans project ***please show solution****

public class TestClass {

    public static void main(String[] args) throws A {

        try {

            f();

        } finally {

            System.out.println("Done.");

        } catch (Exception1 e) {

            throw e;

        }

    }

}

public class Exception1 extends Throwable{}

Test Stem / Question

Choices

What is the problem with the above code?

A: The finally statement must be preceeded by the catch clause

B: Exceptions cannot be extended

C: It is illegal to throw an exception

D: Nothing is wrong

What should be done with the code?

A: Move the catch clause before the finally clause.

B: Do not use Throwable as the supertype of Exception 1.

C: Do not throw the exception.

D: Nothing is wrong

What happens after you have been able to fix the code?

A: “Done” is printed and an exception is shown in the stack

B: “Done” is printed

C: Exception is shown in the stack

D: Nothing is wrong

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution