can someone please explain me, why var is not allowed here, outside the main method? If i were to remove var and make these declarations the "normal" way, this does not happen.
public class Test {
var test = new Test();
var integer = 10;
public void doActionA(){
System.out.println("Hello");
}
public static void main(String[] args){
for(int i = 1; i <100; ++i){
new Thread(() ->{
var test2 = new Test();
var integer2 = 20;
}).start();
}
}
}