O'Reilly logo

The Java® Language Specification, Java SE 7 Edition, Fourth Edition by Alex Buckley, Gilad Bracha, Guy Steele, Bill Joy, James Gosling

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

8.4. Method Declarations

A method declares executable code that can be invoked, passing a fixed number of values as arguments.

MethodDeclaration:      MethodHeader MethodBodyMethodHeader:      MethodModifiersopt TypeParametersopt Result MethodDeclarator ThrowsoptMethodDeclarator:      Identifier ( FormalParameterListopt )

The FormalParameterList is described in §8.4.1, the MethodModifiers clause in §8.4.3, the TypeParameters clause in §8.4.4, the Result clause in §8.4.5, the Throws clause in §8.4.6, and the MethodBody in §8.4.7.

The Identifier in a MethodDeclarator may be used in a name to refer to the method.

It is a compile-time error for the body of a class to declare as members two methods with override-equivalent signatures (§8.4.2).

The ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required