-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
8, 11
-
x86_64
-
generic
A DESCRIPTION OF THE PROBLEM :
static final field can be accessed befor its initiaion
possible duplicate ofJDK-7193460
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
try to compile and run attached source code
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
compilation error
ACTUAL -
output:
0
5
---------- BEGIN SOURCE ----------
public class Main {
private static final int a;
static {
System.out.println(Main.a);
a=5;
System.out.println(a);
}
public static void main(String[] args) {
}
}
---------- END SOURCE ----------
static final field can be accessed befor its initiaion
possible duplicate of
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
try to compile and run attached source code
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
compilation error
ACTUAL -
output:
0
5
---------- BEGIN SOURCE ----------
public class Main {
private static final int a;
static {
System.out.println(Main.a);
a=5;
System.out.println(a);
}
public static void main(String[] args) {
}
}
---------- END SOURCE ----------