1.

What Is The Public Method Modifier?

Answer»

Using the public, private and protected keywords, you can control a VARIABLE's scope. In a similar way, Java lets you use these ATTRIBUTES with class methods as well. A public method is visible everywhere that the class is visible. To declare a method as public, SIMPLY PRECEDE the method header with the public KEYWORD, as shown:

public float myPublicMethod();

Using the public, private and protected keywords, you can control a variable's scope. In a similar way, Java lets you use these attributes with class methods as well. A public method is visible everywhere that the class is visible. To declare a method as public, simply precede the method header with the public keyword, as shown:

public float myPublicMethod();



Discussion

No Comment Found