Re: Does package level access apply to multiple source files?
- From: Mark Space <markspace@xxxxxxxxxxxxxx>
- Date: Sun, 27 May 2007 11:42:51 -0700
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...
.
- Follow-Ups:
- Re: Does package level access apply to multiple source files?
- From: Lew
- Re: Does package level access apply to multiple source files?
- From: Greg R. Broderick
- Re: Does package level access apply to multiple source files?
- References:
- Does package level access apply to multiple source files?
- From: Steve
- Re: Does package level access apply to multiple source files?
- From: Greg R. Broderick
- Does package level access apply to multiple source files?
- Prev by Date: Re: Command line arguments passed to main: how do I access them from other classes? ...
- Next by Date: Re: Does package level access apply to multiple source files?
- Previous by thread: Re: Does package level access apply to multiple source files?
- Next by thread: Re: Does package level access apply to multiple source files?
- Index(es):