The public and static Keywords
Method maximum
’s declaration begins with keyword public
to indicate that the method is “available to the public”—it can be called from methods of other classes. The keyword static
enables the main
method (another static
method) to call maximum
as shown in line 21 without qualifying the method name with the class name MaximumFinder
—static
methods in the same class can call each other directly. Any other class that uses maximum
must fully qualify the method name with the class name.
Get Android™ How to Program, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.