public class Solution {
public int A = 5;
public static int B = 5;
public static int C = 5;
public static int D = 5;
public static void main(String[] args) {
Solution solution = new Solution();
solution.A = 5;
solution.B = 5 * B;
solution.C = 5 * C * D;
Solution.D = 5 * D * C;
Solution.D = 5;
}
public int getA() {
return A;
}
}
i think i need three but am using four static modifiers please help me clerify this...!!!
Resolved
Comments (4)
- Popular
- New
- Old
You must be signed in to leave a comment
Pavlo Plynko Java Developer at CodeGym
29 October 2018, 10:57solution
Since you access B, C and D variables from a static method - they should be static too.
+9
John
12 May 2021, 06:16
How about A?
+1
Pavlo Plynko Java Developer at CodeGym
20 May 2021, 09:51
There is only solution.A in static method, not A itself, so static modifier is not necessary.
+1
Brentachii
2 February 2022, 04:38
thanks that pointed to what needed to be looked at 👍
0