Question 8-2

[5 pts] Suppose we were to execute the following run() method.

public class Question2 {
  public static void f(int n) {
    switch(n) {
    case 0:  return 5;
    case 1:  return 7;
    case 2:  return 9;
    case 3:  return 11;
    default: return 13;
    }
  }
  public static void run() {
    IO.println(f(2));
    IO.println(f(-2));
  }
}
What would it print?

Solution

9
13

Back to 8:00 Quiz 8