BLOCKS AND STATEMENTS
Statements
14.4
hidden field
x
, using the form
this.x
. Indeed, this idiom typically appears in con 
structors ( 8.6):
class Pair {
Object first, second;
public Pair(Object first, Object second) {
this.first = first;
this.second = second;
}
}
In this example, the constructor takes parameters having the same names as the
fields to be initialized. This is simpler than having to invent different names for
the parameters and is not too confusing in this stylized context. In general, how 
ever, it is considered poor style to have local variables with the same names as
fields.
14.3.4   Execution of Local Variable Declarations
A local variable declaration statement is an executable statement. Every time it is
executed, the declarators are processed in order from left to right. If a declarator
has an initialization expression, the expression is evaluated and its value is
assigned to the variable. If a declarator does not have an initialization expression,
then a Java compiler must prove, using exactly the algorithm given in  16, that
every reference to the variable is necessarily preceded by execution of an assign 
ment to the variable. If this is not the case, then a compile time error occurs.
Each initialization (except the first) is executed only if the evaluation of the
preceding initialization expression completes normally. Execution of the local
variable declaration completes normally only if evaluation of the last initialization
expression completes normally; if the local variable declaration contains no ini 
tialization expressions, then executing it always completes normally.
14.4   Statements
There are many kinds of statements in the Java language. Most correspond to
statements in the C and C++ languages, but some are unique to Java.
As in C and C++, the Java
if
 statement suffers from the so called  dangling
else
 problem,  illustrated by this misleadingly formatted example:
if (door.isOpen())
if (resident.isVisible())
resident.greet("Hello!");
else door.bell.ring();
//
A  dangling
else
269






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