I am confused about the rule which states: "You can access static variables and methods, although you can use them only as part of the call to super() or this(). (Example: super(Animal.DoThings()) )"
Why does the following code compile okay (p.327 - Exam Cram):
class Widget extends Thingee
{
static private int widgetCount = 0;
public String wName;
int wNumber;
private static syncronized int addWidget()
{
return ++widgetCount();
}
public Widget()
{
wNumber = addWidget();
}
}
According to this rule, shouldn't the compiler complain about the addWidget call of a static method in the Widget constructor?
Mansi