lLike C++, classes in Java can have member functions (called methods) and data members
•These look the same as in C++ except for the access
control specifier and
•The
implementation of the member functions is provided (in most cases) in the class itself – not elsewhere
lEach member can be
specified as public, private, or protected.
lIf a member has no access control (public, private or protected), they are treated as “friendly”
•the
default means “friendly”: all other classes in the current package have access but all classes outside of this package are
private
•This
allows us to make data members and member functions semi “global” – the scope is somewhat broader than C++ static global but
restricted from actually be
global in nature.
•It allows
us to create a library (a package) and allow related classes to access members directly
•This helps us to organize classes together in a
meaningful way