0
I am unable to print an ultra simple code in Java. It shows the following error:
Exception in thread "main" java.lang.Error: Unresolved Compilation problem: Cannot make a Static Reference to the non-static field dou at Excript_variables.main(Excript_variables.java:10)
The code:
public class Variaveis {
int inteiro = 10;
//float flo = 5.9;
double dou = 3.8;
String texto = "Oi";
public static void main(String[] args) {
System.out.println(dou);
}
}
Thank you!
For a moment of distraction, I hadn’t noticed the question of static context. + 1
– viana