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
πŸ’¬ Discuss
βœ… Correct Answer: (A) Compile with error

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
93
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Vinay
Publisher
πŸ“ˆ
81%
Success Rate