1.

Explain The Private Field Modifier?

Answer»

To control a class member variable's SCOPE, you can precede the variable's declaration with the public, private or protected key words. A private variable is only visible within its class. SUBCLASSES cannot access private variables. To declare a variable private, SIMPLY use the private KEYWORD at the START of the variable declaration, as shown:
private int InvisibleOutside;

To control a class member variable's scope, you can precede the variable's declaration with the public, private or protected key words. A private variable is only visible within its class. Subclasses cannot access private variables. To declare a variable private, simply use the private keyword at the start of the variable declaration, as shown:
private int InvisibleOutside;



Discussion

No Comment Found