class FinalConcept
{
private final int number = 22;
public static void main(String args[])
{
try{
FinalConcept obj = new FinalConcept();
System.out.println("value of the x variable "+obj.number);
Field obj1 = obj.getClass().getDeclaredField("number");
obj1.setAccessible(true);
obj1.setInt(obj,45);
If I try to access the variable by field function then I get changed value
System.out.println("value of the x variable "+obj1.get(obj));//45
But if I try to access by the name of variable, I get the same value
System.out.println("value of x varialbe "+obj.x);//22
Why is this hapenning ?