1.

Can You Explain The Private Protected Field Modifier?

Answer»

To control a class member VARIABLE's scope, you can precede the variable's DECLARATION with the PUBLIC, private or protected keywords. A private protected variable is only VISIBLE within its class and within subclasses of the class. The difference between a protected class member and a private protected variable is that a private protected variable is not ACCESSIBLE within its package. To declare a variable private protected, simply use the private protected keyword at the start of variable declaration, as shown:

private protected int ImPrivateProtected;

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

private protected int ImPrivateProtected;



Discussion

No Comment Found