D
Dirk Bruere at NeoPax
rossum said:public class Example {....
Still waiting on some sort of code example....
static class MyClass {
static int myStatic = 42;
}
public static void main(String[] args) {
MyClass mc = new MyClass();
System.out.println("Static class variable = " + mc.myStatic);
System.out.println("Static class variable = " + MyClass.myStatic);
}
}
The first println gives the symptoms the OP describes: "Accessing
static field ..." Clicking on the lightbulb icon gives two oprtions:
1 Replace with class reference.
2 Suppress Warning - static-access.
On the general principle that suppressing warnings is a BAD THING,
without very good reasons to do so, I would suggest that the first of
the two options is the better choice.
rossum
Thanks - I did not realise I could click on the light bulb!
--
Dirk
http://www.transcendence.me.uk/ - Transcendence UK
http://www.theconsensus.org/ - A UK political party
http://www.onetribe.me.uk/wordpress/?cat=5 - Our podcasts on weird stuff