15.11.3
Compile Time Step 3: Is the Chosen Method Appropriate?
EXPRESSIONS
15.11.3   Compile Time Step 3: Is the Chosen Method Appropriate?
If there is a most specific method declaration for a method invocation, it is called
the
compile time declaration
 for the method invocation. Two further checks must
be made on the compile time declaration:
If the method invocation has, before the left parenthesis, a
MethodName
 of
the form
Identifier
, and the method invocation appears within a
static
method, a static initializer, or the initializer for a
static
 variable, then the
compile time declaration must be
static
. If, instead, the compile time decla 
ration for the method invocation is for an instance method, then a compile 
time error occurs. (The reason is that a method invocation of this form cannot
be used to invoke an instance method in places where
this
 ( 15.7.2) is not
defined.)
If the method invocation has, before the left parenthesis, a
MethodName
 of
the form
TypeName
.
Identifier
, then the compile time declaration should be
static
. If the compile time declaration for the method invocation is for an
instance method, then a compile time error occurs. (The reason is that a
method invocation of this form does not specify a reference to an object that
can serve as
this
 within the instance method.)
If the compile time declaration for the method invocation is
void
, then the
method invocation must be a top level expression, that is, the
Expression
 in an
expression statement ( 14.7) or in the
ForInit
 or
ForUpdate
 part of a
for
statement ( 14.12), or a compile time error occurs. (The reason is that such a
method invocation produces no value and so must be used only in a situation
where a value is not needed.)
The following compile time information is then associated with the method
invocation for use at run time:
The name of the method.
The class or interface that contains the compile time declaration.
The number of parameters and the types of the parameters, in order.
The result type, or
void
, as declared in the compile time declaration.
The invocation mode, computed as follows:
N
If the compile time declaration has the
static
 modifier, then the invocation
mode is
static
.
N
Otherwise, if the compile time declaration has the
private
 modifier, then
the invocation mode is
nonvirtual
.
332






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