Wednesday 28 August 2013

Auto Widening

Converting of one numeric primitive datatype to another  numeric primitive datatype.

6 primitive numeric datatype according to their size...

                               byte<short<int<long<float<double
narrowest - byte
widest - double
Auto widening means automatically converting  into corresponding wider.
converting narrower into wider

Example;-

auto widening occurs

Example 2


 in this we automatically convert int type into double type.

Example 3:-

in this return type int is automatically convert into double type.

Example 4:-


in this byte is converted into short.
short is converted into int
int is converted into double.

No comments :

Post a Comment