1.

Explain The Protected Field Modifier?

Answer»

To control a CLASS MEMBER variable's scope, you can precede the variable's declaration with the public, private ox protected keywords. A protected variable is one that is only visible within its class, within subclasses or within the package that the class is PART of. The different between a private class member and a protected class member is that & private class member is not accessible within a SUBCLASS. To declare a variable protected, simply use the protected keyword at the start of the variable declaration, as SHOWN:

protected int ImProtected;

To control a class member variable's scope, you can precede the variable's declaration with the public, private ox protected keywords. A protected variable is one that is only visible within its class, within subclasses or within the package that the class is part of. The different between a private class member and a protected class member is that & private class member is not accessible within a subclass. To declare a variable protected, simply use the protected keyword at the start of the variable declaration, as shown:

protected int ImProtected;



Discussion

No Comment Found