I was going through a couple of questions that are often asked in job interviews (at least in my country - Switzerland), and I was quite unsure about the output of a block of code that is supposed to be tricky. It would be nice to hear what you think the correct answer is.
here it is :
 public class LanguageTest12 {
   public static void main(String... args){
       System.out.println(foo());
   }
   private static int foo() {
      int a = 1, b = 2;
      try {
          return a+b;
      } finally {
          a = 10;
          b = 20;
          return a+b;
     }
   }
 }
I know however that the answer must be one of those three possibilities :
- 3
- 30
- 33
(PS: just in case someone is interested, here are the all the questions : http://se.inf.ethz.ch/courses/2014a_spring/JavaCSharp/exercise_sessions/ExerciseSession5.pdf)
 
    