6.5.6
Meaning of Method Names
NAMES
The example:
class Point {
int x, y;
static int nPoints;
}
class Test {
public static void main(String[] args) {
int i = 0;
i.x++;
//
compile time error
Point p = new Point();
p.nPoints();
//
compile time error
}
}
encounters two compile time errors, because the
int
 variable
i
 has no members,
and because
nPoints
 is not a method of class
Point
.
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 fur 
ther discussion of the interpretation of qualified method names in method invoca 
tion expressions.
98






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Inexpensive Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Jsp Hosting Cheap Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved