I thought static primitive variables in java should work differently than non-static when passed to a method:
public class Main {
private static int a;
public static void main(String[] args) {
modify(a);
System.out.println(a);
}
static void modify(int a){
a++;
}
}
The output is 0 which is understandable for primitives passed by value, but why static doesn't mean anything here? I would expect 1 as an output.
Maybe a silly question but I am confused.