Error: Non-static method overrides static method

Chris Gray chris.gray@kiffer.be
Mon Jun 28 21:44:00 GMT 2004


On Monday 28 June 2004 20:25, Tom Tromey wrote:

> Furthermore, it is a little-known corner of the Java language that
> you can write:
>
>     expr.method ();
>
> ... where `method' is a static method.  This evaluates `expr' for side
> effects and then calls the static method.  Goofy, perhaps useless, but
> there it is.

Sometimes I'm glad I only have to deal with bytecode. :0 Out of curiosity, 
what means "evaluates `expr' for side effects"? Is
    instanceOfFoo.instanceMethod().staticMethod()
somehow different to 
  instanceOfFoo.instanceMethod(); Foo.staticMethod();
or is there some other magic involved?

-- 
Chris Gray                      /k/ Embedded Java Solutions
Embedded & Mobile Java, OSGi        http://www.kiffer.be/k/
chris.gray@kiffer.be                         +32 3 216 0369



More information about the Java mailing list