class MyClass {
}
class Widget extends MyClass {
static private int widgetCount = 0;
static synchronized int addWidget() {
widgetCount++;
return widgetCount;
}
int anotherMethod() {
return widgetCount;
}
}
A. methods in the Widget class can access it.
B. only the addWidget method can access it.
C. If another class tries to access widgetCount, a runtime exception will be thrown.
D. only methods in the Widget class and any derived classes can access it.
|