1.

What Is The Public Field Modifier?

Answer»

A variable's scope defines the locations within a program where the variable is known. Within a class definition, you can control a class MEMBER variable's scope by preceding a variable's declaration with the public, PRIVATE or protected KEYWORDS. A public variable is visible (accessible) everywhere in the program where the class itself is visible (accessible). To declare a variable public, SIMPLY USE the public keyword at the start of the variable declaration, as shown:
public int seeMeEveryWhere;

A variable's scope defines the locations within a program where the variable is known. Within a class definition, you can control a class member variable's scope by preceding a variable's declaration with the public, private or protected keywords. A public variable is visible (accessible) everywhere in the program where the class itself is visible (accessible). To declare a variable public, simply use the public keyword at the start of the variable declaration, as shown:
public int seeMeEveryWhere;



Discussion

No Comment Found