sample code explicit typecasting
By explicit type casting, if we assign a big value to the small data type, The most significant bit will be lost
public class ImplicitCast {
public static void main (String ar[]){
int i=10;
float f=i;
System.out.println(f); //10.0
char ch='a';
int j=ch;
System. out.println(j); //97
}
}
3 comments:
hai...i know if assign a big value to the small data type, the most significant bit will be lost. then why the explicit example is same like implicit one.may i knw why?
please post some exceptional examples so, that will be more helpful.
dai explicit conversion post panu da
Post a Comment