Description:
Static members should be referenced through class names rather than through objects. If static member is referenced through object the error message is generated.
Example:
class AOSMTO1 {
void func () {
AOSMTO1 obj1 = new AOSMTO1();
AOSMTO2 obj2 = new AOSMTO2();
obj1.attr = 10;
obj2.attr = 20;
obj1.oper();
obj2.oper();
this.attr++;
this.oper();
}
static int attr;
static void oper () {}
}
class AOSMTO2 {
static int attr;
static void oper () {}
}