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);
}
}
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. 6
E. 0
Answer: Option A

bcause scope of variable a is limited to static block. outside the static block variable a has not identification.
the variable 'a' in static block cannot able to access using this keyword
why compile time error
Why explain old