Re: Does package level access apply to multiple source files?



Greg R. Broderick wrote:

If the method (NOT FUNCTION!) in the other class is static, then it may e accessed using the syntax

ClassName.methodName();

I haven't checked but wouldn't import help here? Maybe even static import, if the method is static:

import ClassName;

methodName();

Maybe this is where the OP is getting confused. I think static import would work the same as import here, but I haven't checked that either.


otherwise, you must create an instance of the containing class and invoke the other class' method on that instance of the class.

ClassName clazz = new ClassName();
clazz.methodName();

Here I think import doesn't help and wouldn't matter...
.