What will be the output for the below code?
public class Test{
static{
int a = 5;
}
public static void main(String[] args){
System.out.println(a);
}
}
public class Test{
static{
int a = 5;
}
public static void main(String[] args){
System.out.println(a);
}
}A. Compile with error
B. 5
C. 0
D. Runtime Exception
E. None of these
Answer: Option A

Join The Discussion