How this is possible? How am I able to change variables marked as final?
public class Main
{
public static void main(String[] args)
{
final int NUM;
NUM = 22;
NUM = 33;
System.out.println(NUM);
}
}
I was using AIDE app in Android... it compiled successfully and printed 33
.
If you can do this, it is a bug in the AIDE app. You should report it to the developers. A JLS compliant implementation of Java does not allow reassignment of
final
variables (like this).If you want to give them a JLS specification reference to support your bug report: