If final variable is initialized in parameterized constructor and data is assigned through constructor args then final value seems to be changing here for every object.
public class Test {
final int k;
Test(int i){ this.k=i;}
public static void main(String[] args) {
for(int i=1;i<=5;i++){
Test t= new Test(i);
System.out.println(t.k);}
}
}
Is the final variable not changable at instance level alone or across all instance it should be constant.?
The final variable is assigned to the instance. If you create multiple instances of the Test class, they will have their own version of the final variable. If the final variable is static, it will be only be set once for all the instances.