Java 14
public class Ex14 {
static String strDef = "At the point of definition";
static {String strBlock = "In a static block";}
public static void main (String [] args){
System.out.println(Ex14.strDef);
System.out.println(Ex14.strBlock);
}
}
Result
$ javac Ex14.java
Ex14.java:10: error: cannot find symbol
System.out.println(Ex14.strBlock);
^
symbol: variable strBlock
location: class Ex14
1 error
Could you help me understand why this error happens?