stevesean chen wrote:Thanks for the detail explanation, Dan Craciun. Really appreciate your help. So according to my understanding, private makes fields completely hidden away from outside of current class. Public allowed the access, and adding a final just prevent the fields from being modified outside of the current class.
Final means the field cannot be modified at all--inside or outside of the declaring class.
The access control (public/protected/((no keyword, meaning package-private))/private) determines who can even *see* that member--who can know that field, method, etc. exists and refer to it.
Completely independent of that, is final, which means "cannot be modified" for member variables and "cannot be overridden" for methods.
You almost always want to make all your fields private.