This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: refering to inner classes from imports doesn't work
- From: Nic Ferrier <nferrier at tapsellferrier dot co dot uk>
- To: Cedric Berger <cedric at wireless-networks dot com>
- Cc: java at gcc dot gnu dot org, Bryce McKinlay <bryce at waitaki dot otago dot ac dot nz>
- Date: 08 Feb 2002 13:18:06 +0000
- Subject: Re: refering to inner classes from imports doesn't work
- References: <87u1sszwe1.fsf@tf1.tapsellferrier.co.uk><3C6394D5.30208@wireless-networks.com>
Cedric Berger <cedric@wireless-networks.com> writes:
> >
> >
> >public class A
> >{
> > public static X createSomething ()
> > {
> > return new X();
> > }
> >
> > public class X
> > {
> > public void someMethod ()
> > {
> > return;
> > }
> > }
> >}
> >
> How can the *static* method createSomething() create the *non-static*
> class A?
> Cedric
Sorry, it's another case of leaving stuff out to be economical:
public class A
{
public static X createSomething ()
{
A something = new A();
return something.thing();
}
public X thing()
{
return new X();
}
public class X
{
public void someMethod ()
{
return;
}
}
}
Nic