Wednesday 28 August 2013

Explicit Narrowing

Explicit Narrowing means converting wider into narrower.
sometime loss of value takes place in narrowing.
convert higher datatype into lower datatype.
opposite of auto widening.

Example 1-

in this we explicitly convert double type into int type.
for explicit conversion we must use int present as highlighted
if we don't use this it will give error.

Example 2
double is narrowing to int

Example 3-


all types of narrowing take place....

No comments :

Post a Comment