Can we declare Static
Variables inside Main
method? Because I am getting an error message:
Illegal Start of Expression
Obviously, no, we can't.
In Java, static
means that it's a variable/method of a class, it belongs to the whole class but not to one of its certain objects.
This means that static
keyword can be used only in a 'class scope' i.e. it doesn't have any sense inside methods.