example code implicitcasting
Compiler is responsible for implicit type casting Before see the example see this diagram it is very easy to understand.
All possible implicit type casting
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpuvziacunika6RJKFN_NfAtaGkrrSTPDzMwXTiypBqiIc_TLxipsQcf6tg8nLLsLCPiigHXnVpbau3jwVWFlHKwszN6v5TIgC0rhVkTZPBODIuBn7glnXaYGAZuxYlLEMC2tlI3Ca0bY/s400/implicitcasting.png)
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
}
}
0 comments:
Post a Comment