lWhat is the meaning
in Java of public, private, and protected?
lAs is expected, public means that the member following is public to everyone using this library
lPrivate is not available – only other methods within the class can access that member
•Helper methods should be private
lProtected members are available within this class and a derived class (same as C++)
lRecommendation:
limit your use of the default friendly access
•(Please
note, a derived class may not be able to access its parent’s “friendly” members if they are not in the same package!
This is because it is possible
to inherit from a class that is not in the same package.)