6.5.6 Meaning of Method Names

A MethodName can appear only in a method invocation expression (§15.11). The meaning of a name classified as a MethodName is determined as follows.

6.5.6.1 Simple Method Names

If a method name consists of a single Identifier, then Identifier is the method name to be used for method invocation. The Identifier must name at least one method of the class or interface within whose declaration the Identifier appears. See §15.11 for further discussion of the interpretation of simple method names in method invocation expressions.

6.5.6.2 Qualified Method Names

If a method name is of the form Q.Id, then Q has already been classified as a package name, a type name, or an expression name. If Q is a package name, then a compile-time error occurs. Otherwise, Id is the method name to be used for method invocation. If Q is a type name, then Id must name at least one static method of the type Q. If Q is an expression name, then let T be the type of the expression Q; Id must name at least one method of the type T. See §15.11 for further discussion of the interpretation of qualified method names in method invocation expressions.