Question discussion

What will be the output?public class Test{ static{ int a = 5; } public static void main(String args[]){ new Test().call(); } void call(){ t…

295844Medium 1 reply 714 views
40
What will be the output?public class Test{ static{ int a = 5; } public static void main(String args[]){ new Test().call(); } void call(){ this.a++; System.out.print(this.a); }}
  • ACompile with error
  • BRuntime Exception
  • C5
  • D6
  • E0
Correct answer: A

Discussion 1

0
CCommunity
Compile with error