why doesn't this code give an error>
public satic void main(String a[]){
long m=5;
float f =m;???
float is 32 in size and long is 64bits...
but it still compiles and does not give any error
Pl.carefully read Com.Ref.Java2,Schidt.It is clearly mentioned that the width of data types is nothing to do with their storage,but certainly & only with their behavoiur.Hence in above case direct widening conversion takes place,legal in
Java.
Long ,even if 32 bit,ignores the 0's and takes into consideration only whole value of th egiven int.In case of float which is necesarily an int with decimal part,can very
take care of lomg with assingnged in above way.
Hope if u r clear.
Pl.correct me if I am wrong.