Skills101
← All practice quizzes

Quiz: Java Exception Handling

5 questionsNo time limitPass: 60%+10 XP on first pass

The exception hierarchy as a picture, checked vs unchecked exceptions, try-catch-finally, multi-catch, try-with-resources, throw vs throws, and custom exceptions.

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    What does this print?

    public class Main {
        public static void main(String[] args) {
            try {
                System.out.print("A");
                int x = 5 / 0;
                System.out.print("B");
            } catch (ArithmeticException e) {
                System.out.print("C");
            } finally {
                System.out.print("D");
            }
        }
    }
    
  2. Question 2

    Which is a checked exception?

  3. Question 3

    What is the difference between throw and throws?

  4. Question 4

    Which order of catch blocks compiles?

  5. Question 5

    What does try-with-resources guarantee?