Only variables and methods may be declared protected.
A protected is available to all classes in the same package.
A protected is available with limitation to all subclasses of the class.
protected = package + kids.
package mypackage1;
class MyClass {
protected void myMethod() { ... }
}
package mypackage2;
class MySubclass extends MyClass {
protected void enhancedMethod() {
myMethod();
}
}
|