I'm new to java and I have been exploring the different variable types. Right now I am trying to determine is printed when I add 1 to a byte variable of value 127 (the maximum value for a byte var). This is what my code looks like:
public class vars {
byte b = 127;
byte c = 1;
public static void main(String[] args) {
System.out.println(b + c);
}
}
and on my System.out.println line I get the error message that my non-static variables, b and c, cannot be referenced from a static context. How should I fix this? Is there a better way to do this project in general?
Thanks