EXPRESSIONS
Field Access Expressions
15.10
15.9.3   Example: Array Creation and Out of Memory Detection
If evaluation of an array creation expression finds there is insufficient memory to
perform the creation operation, then an
OutOfMemoryError
 is thrown. This check
occurs only after evaluation of all dimension expressions has completed normally.
So, for example, the test program:
class Test {
public static void main(String[] args) {
int len = 0, oldlen = 0;
Object[] a = new Object[0];
try {
for (;;) {
++len;
Object[] temp = new Object[oldlen = len];
temp[0] = a;
a = temp;
}
} catch (Error e) {
System.out.println(e + ", " + (oldlen==len));
}
}
}
prints:
java.lang.OutOfMemoryError, true
because the out of memory condition is detected after the argument expression
oldlen
 =
len
 is evaluated.
Compare this to class instance creation expressions ( 15.8), which detect the
out of memory condition before evaluating argument expressions ( 15.8.2).
15.10   Field Access Expressions
A field access expression may access a field of an object or array, a reference to
which is the value of either an expression or the special keyword
super
. (It is also
possible to refer to a field of the current instance or current class by using a simple
name; see  15.13.1.)
FieldAccess:
Primary
 .
Identifier
super .
Identifier
The meaning of a field access expression is determined using the same rules
as for qualified names ( 6.6), but limited by the fact that an expression cannot
denote a package, class type, or interface type.
319






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