How can we change Final variable ones we initialize? can any explain with example.how can we change final keyword
class Demo{
final int MAX_VALUE=99;
void myMethod(){
MAX_VALUE=101;
}
public static void main(String args[]){
Demo obj=new Demo();
obj.myMethod();
}
}
You can change the final variable for every instance of the class using blank final variable.
Example:
public class Main {
private final int no;
Main(int no){
this.no = no;
}}