in java i know that final variables value cannot be changed. please see the below program and help me how the final value is changed.
public class MainClass {
final static int name=123;
public static void main(String[] args) {
System.out.println(name+123);
}
}
Out put is 246**
Thanks!
The value of
nameis not changed, there is a temporary value created for the output.Try
it will fail to compile.