I am learning to program remotely (which I combine with a job that has nothing to do with programming) and I have a question about Java with Netbeans. Here the code:
public class PROG02_Ejer03 {
public static void main(String[] args) {
boolean casado = true;
static final int MAXIMO = 999999;
byte diasemana;
short diaano;
boolean sexo;
long milisegundosdesde1970;
float factura;
long poblacionmundial;
} // Aquí cierro el método main
} //Aquí cierro la public class
Specifically, it gives me an error on the line:
static final int MAXIMO = 999999;
netbeans tells me
illegal start of expression
and it marks me in yellow MAXIMO
, but I've been looking and I can't find the error anywhere, it's a constant and constants by convention are written in uppercase).
The last key, which I understand is to close the public class but Netbeans tells me
class, interface or enum expected.
The "static" declaration indicates that it is an accessible variable without having to instantiate a class. In this case you are inside a main of a main program, so you can't declare it static