4.3. Defining Methods
The general syntax of a method declaration is
<method modifiers> <return type> <method name> (<formal parameter list>) <throws clause> // Method prototype{ // Method body <local variable declarations> <nested local class declarations> <statements>}
In addition to the name of the method, the method prototype can specify the following information:
scope or accessibility modifier (see Section 4.5, p. 121)
additional method modifiers (see Section 4.10, p. 144)
the type of the return value, or void if the method does not return any value (see Section 5.4, p. 176)
a formal parameter list
checked exceptions thrown by the method in a throws clause (see Section 5.9, p. 201)
The formal parameter list is a comma-separated ...
Get Programmer's Guide to Java™ Certification, A: A Comprehensive Primer, 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.