Aliensbrain
  • Home
  • Topics
  • Quizzes
  • Notebooks
  • Community
  • Sign in
  • programming languages Online Quiz - 113
  • class Demo { static String s = "-"; public static void ...

class Demo { static String s = "-"; public static void main(String[] args) { new Demo().method1() ; System.out.println(s); } void method1() { try { method2();} catch (Exception e) { s += "c"; } } void method2() throws Exception { method3(); s += "2"; method3(); s += "2b"; } void method3() throws Exception { throw new Exception(); } } What is the result?

technology programming languages
  1. -

  2. -c

  3. -c2

  4. -2c

  5. -c22b

  6. Compilation fails.


Show answer
Correct Option: B

Find more quizzes:

© Aliensbrain | all rights reserved
  • About
  • Contact
  • Terms and Condition
  • Privacy Policy