Test Your Knowledge

Test your understanding of exceptions.

1

What will be the result of the code when executed?

class Exceptions {
    public static void main( String args[] ) {

        try{
          throw new ArithmeticException();
        }catch(Exception e){
          System.out.println("Catch");
          throw new NullPointerException();
        }finally{
          System.out.println("Finally");
          throw new NumberFormatException();
        }
    }
}
A)

Prints Catch and Finally

B)

Prints Catch and NumberFormatException

C)

Prints the NumberFormatException

D)

Prints Catch and Finally and the NumberFormatException

Question 1 of 70 attempted