Static method doesn't allow me to access a global variable?
I can't access the abc variable from static metod which is defined below. why it is not allowed to this? class sample { int abc = 1; void foo1() { abc // accessible } static void foo2() { abc // why not accessible? } }
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Roei BarRank #1,271 · 1.4K reputationPosted Sep 12, 2009, 7:38 AM EDT
write the abc variable as:
static abc;
and it will be accessible