You can use an enum type from Java 5 for the purpose you have described, It is type-safe.
A is an instance variable. Constants just mean the value doesn’t change.
Instance variables are data members belonging to the object and not the class. Instance variable = instance field.
If you are talking about the difference between the instance variable and the class variable, the instance variable exists per object created. While the class variable has only one copy per class loader regardless of the number of objects created.
Want to learn Java? Check out the Java certification from Intellipaat.