Type Casting (Cont.)
Narrowing Casting
Narrowing casting is to convert a larger-size type to a smaller-size type.
It must be done manually by placing the type in parantheses in front of the value; for example:
double myDouble = 10.0;
int myInt = (int) myDouble;
NCasting.java (narrowing casting)
|
|
|
The bigger they are the harder they fall.
|