Hi all,
The below program is absolutely correct. Its output is 30.My doubt is we know that we cann't change the value of final variable.If we tries, it would give compiler error.
I need clarification
please explain this if you know
given two files.
-----------------
package xcom;
public class Stuff {
public static final int MY_CONSTANT=5;
public static int doStuff(int x)
{return (x++)*x;};
}
import xcom.Stuff.*;
import static java.lang.System.out;
class User extends Stuff{
public static void main(
String[]a){
new User().go();
}
void go(){out.println(doStuff(MY_CONSTANT));}
}
}