One other possibility remains: If you use none of the protection
keywordspublic
,
protected
, or private
then you provide access to the rest
of the compilation unit and to the rest of the package, but to nothing
else:
*------------------------------------------------------------* | Everywhere else | *------------------------ | ---------------------------------* | | | ^ *-* *------------------------------------------------------------* | *--------------------------------* *-------------------* | | | *-------------* | | | | | | | Same | | | | | | | | class | | | | | | | | | | | | | | | | Rest of the | v | | | Other compilation | | | | compilation -----> minutes <-------- unit, same package| | | | unit | | | | | | | | *-------------* | | | | | *--------------------------------* *-------------------* | *------------------------------------------------------------* *-* | v | | *------------------------ | ---------------------------------* | *---------------------- | -------------------------------* | | | *----------- | -------* | | | | | Subclass in another | | | | | | compilation unit in | | | | | | another package | | | | | *---------------------* | | | *--------------------------------------------------------* | *------------------------------------------------------------*