Question

Java NetBeans project ***please show solution**** public class TestClass {     public static void main(String[] args)...

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

0 0
Add a comment Improve this question Transcribed image text
Answer #1

What is the problem with the above code?
A: The finally statement must be preceeded by the catch clause

What should be done with the code?
A: Move the catch clause before the finally clause.

What happens after you have been able to fix the code?
A: “Done” is printed and an exception is shown in the stack

Add a comment
Know the answer?
Add Answer to:
Java NetBeans project ***please show solution**** public class TestClass {     public static void main(String[] args)...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT