I got an error that says "non-static variable constantInteger cannot be referenced from a static context"
How do I add all three integers without changing their level?
public class VariableAdder {
final int constantInteger = 5;
int instanceInteger = 10;
public static void main(String[] args) {
int methodInteger = 20;
int result = constantInteger + instanceInteger + methodInteger;
System.out.println(result);
}
}
Expected results: adding two instance variables and one method variable and printing. Actual results: error
Thank you all for your help!