Yeah, a variable in
java will change it's value if you declare it to different value.
int a = 10;
a = 20;
You changed the value of the variable int a. It first represented 10, and then you changed the value to 20. If you want something else to represent 20, besides a, you can give it a different name. For example:
int a = 10;
int b = 20;
or declare it and initialize it in two different steps:
int a, int b;
a = 10;
b = 20 ;
That way it doesn't over ride the value of a.
In your code, you shouldn't declare a again.
You should be able to simply use a, which represent 10. You don't have to tell the compiler that a = 10 again once it's been declared.