Hey Guys,
I follow the “A Programmers guide to
Java Certification” by Khalid Mughal.
It was stated that the Widening conversion takes place in the trasitive order given below
byte -> short-> int -> long -> float -> double
char -> int -> long -> float -> double
From the above stated rule, I presume that the following is a widening conversion.
long bigInteger = 987654321123456789L;
float realNo = bigInteger;
I had No doubt till this point.
Guys, Now just stop here for a while and I would ask you to roll back your memories to the size of data types.
The size of long is 64 bits and the float is just 32 bits.
I don’t think that the “long” number would be able to fit comfortably within a float variable which is obviously less than the size of long datatype.
How can this be regarded as a widening conversion?
I don’t know, if I am asking so silly. Anyway a doubt is a doubt. Somebody please throw light on this
[ September 02, 2005: Message edited by: Kalyana Sundaram ]