Of course, if you mark a variable or method with the public
keyword,
you provide access from all compilation units in all packages:
*------------------------------------------------------------* | Everywhere else | *------------------------ | ---------------------------------* | | | *------------------------ | ---------------------------------* | *---------------------- | -------* *-------------------* | | | *----- v -----* | | | | | | | Same | | | | | | | | class | | | | | | | | | | | | | | | | Rest of the | v | | | Other compilation | | | | compilation -----> minutes <-------- unit, same package| | | | unit | ^ | | | | | | | | | | | | | | | | *----- | -----* | | | | | *---------------------- | -------* *-------------------* | *------------------------ | ---------------------------------* | | | *------------------------ | ---------------------------------* | *---------------------- | -------------------------------* | | | *----------- | -------* | | | | | Subclass in another | | | | | | compilation unit in | | | | | | another package | | | | | *---------------------* | | | *--------------------------------------------------------* | *------------------------------------------------------------*