Czy mógłby mi ktoś wyjaśnić, dlaczego metody które nie są zadeklarowane jako statyczne, mogą zwracać wartość z pól statycznych?
public class Solution {
public static int A = 5;
public static int B = 2;
public int C = A * B;
public static int D = B * A;
public static void main(String[] args) {
Solution solution = new Solution();
System.out.println(solution.getValue());
}
public int getValue() {
return A;
}
int getValue2() {
return C;
}
}