4.3.4
When Reference Types Are the Same
TYPES, VALUES, AND VARIABLES
4.3.4   When Reference Types Are the Same
Two reference types the
same type
 if:
They are both class or both interface types, are loaded by the same class
loader, and have the same fully qualified name ( 6.6), in which case they are
sometimes said to be the
same class
 or the
same interface
.
They are both array types, and have the same component type ( 10).
4.4   Where Types Are Used
Types are used when they appear in declarations or in certain expressions.
The following code fragment contains one or more instances of each kind of
usage of a type:
import java.util.Random;
class MiscMath {
int divisor;
MiscMath(int divisor) {
this.divisor = divisor;
}
float ratio(long l) {
try {
l /= divisor;
} catch (Exception e) {
if (e instanceof ArithmeticException)
l = Long.MAX_VALUE;
else
l = 0;
}
return (float)l;
}
double gausser() {
Random r = new Random();
double[] val = new double[2];
val[0] = r.nextGaussian();
val[1] = r.nextGaussian();
return (val[0] + val[1]) / 2;
}
}
In this example, types are used in declarations of the following:
42






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