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've never heard of it -- in any serious sense -- as a security issue. I mean, decompilers work. You can use them to figure out what's going on inside the bytecode.
Having private
members is a maintainability issue. If I only give you method-level access to my internals, then my only responsibility is to ensure that my API methods continue to work. I'm not locked into using a Double
versus a BigDecimal
on the insides, so long as my methods continue to return Double
s (for instance).