8.4.1
Formal Parameters
CLASSES
MethodDeclarator:
MethodDeclarator
 [ ]
but should not be used in new Java code.
It is a compile time error for the body of a class to have as members two
methods with the same signature ( 8.4.2) (name, number of parameters, and types
of any parameters). Methods and fields may have the same name, since they are
used in different contexts and are disambiguated by the different lookup proce 
dures ( 6.5).
8.4.1   Formal Parameters
The
formal parameters
 of a method, if any, are specified by a list of comma sepa 
rated parameter specifiers. Each parameter specifier consists of a type and an iden 
tifier (optionally followed by brackets) that specifies the name of the parameter:
FormalParameterList:
FormalParameter
FormalParameterList
 ,
FormalParameter
FormalParameter:
Type VariableDeclaratorId
The following is repeated from  8.3 to make the presentation here clearer:
VariableDeclaratorId:
Identifier
VariableDeclaratorId
 [ ]
If a method has no parameters, only an empty pair of parentheses appears in
the method's declaration.
If two formal parameters are declared to have the same name (that is, their
declarations mention the same
Identifier
), then a compile time error occurs.
When the method is invoked ( 15.11), the values of the actual argument
expressions initialize newly created parameter variables, each of the declared
Type,
 before execution of the body of the method. The
Identifier
 that appears in
the
DeclaratorId
 may be used as a simple name in the body of the method to refer
to the formal parameter.
The scope of formal parameter names is the entire body of the method. These
parameter names may not be redeclared as local variables or exception parameters
within the method; that is, hiding the name of a parameter is not permitted.
Formal parameters are referred to only using simple names, never by using
qualified names ( 6.6).
156






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