0
Just read that non-static method cannot rewrite static variables.Tried and found otherwise can somebody explains ?
Java static non-static differences
1 Odpowiedź
0
Apparently, it was written on the contrary. Like:
"non-static variable a cannot be referenced from a static context"
because non-static can rewrite static:
public class Program {
static int a=0;
public static void main(String[] args) {
new Program().test();
System.out.println(a); //1
}
void test() {
a = 1;
}
}