The public
reserved word in Java is one of 4 visibility or accessibility
modifiers. These modifiers restrict access to the members (variables or methods)
to which they are applied. Classes or members declared public
can
be accessed by any other class. Classes or members declared private
can only be accessed by the class itself. Classes or members declared protected
can only be accessed by the class and any of its subclasses. By ommitting any
visibility modifier, you declare the class or member to be of default
visibility. This forth modifier allows access from any classes in the same package
as the current class.