I have some doubts about access modifiers used for top level classes in Java.
1) Can access modifier public or default be used only with top level classes or even with nested classes?
2) Lets say there are two different classes A and B, both in different packages. Then in order to have access (acess to class members) to class A by class B , then both top level class, that is ‘A’ as well as class members should be defined public, right ? If either class or class members are not public then class B will not have access to class A, right ?
Please correct if I'm wrong.