Question Info

This question is public and is used in 23 tests or worksheets.

Type: Multiple-Choice
Category: Java and JSP
Level: Continuing Education
Score: 1
Author: BacMan
Last Modified: 10 years ago

View all questions by BacMan.

Java and JSP Question

View this question.

Add this question to a group or test by clicking the appropriate button below.

Continuing Education Java and JSP

What is the output of this program?

public class CatchMe {

    public static int getNumber() throws NumberFormatException {
        try {
            return Integer.parseInt("negative one");
        } catch (NumberFormatException nfe) {
            return 0;
        } finally {
            return Integer.parseInt("5");
        }
    }

    public static void main (String args[]) {
        System.out.println(getNumber());
    }
}
  1. 0
  2. NumberFormatException is thrown
  3. -1
  4. 5