Learning Java I was sometimes taught to use the private
access modifier so as not to expose \"sensitive information\" to other classes, as if this could open a legi
I agree in general with the answers so far (i.e. that private
is really for code hygiene not real security). Various answers have pointed out that you can bypass private
using reflection. Note that you can, in turn, disable reflection if you enable a Java SecurityManager. See particularly the ReflectPermission. However, security managers are rarely used (outside the normal browser sandboxing).