I have following code which raises exception:
public class Test {
static final int STACK_EMPTY = -1;
static int STACK_FULL = 10;
public static void main(String[] args) {
STACK_FULL = 12;
STACK_EMPTY = 2;
}
}
Exception:
The final field Test.STACK_EMPTY cannot be assigned
If you cant reassign value to a final attribute, then what is the use of it?