A

Admin • 828.03K Points
Coach

Q. 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);
}
}

  • (A) Compile with error
  • (B) Runtime Exception
  • (C) 5
  • (D) 5 D. 6
  • Correct Answer - Option(A)
  • Views: 11
  • Filed under category Java
  • Hashtags:

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.