typecasting
Write a program to show typecasting.
class P05TypeCasting { public static void main() { int a= 10000; byte b= 10; int c= b; //byte d= a; not possible due to lossy conversion byte d= (byte)a; //forceful conversion System.out.println(" Declared integer "+a); System.out.println(" Declared byte "+b); System.out.println(" Declared int stored byte "+c); System.out.println(" Declared byte stored int--- Typecasting "+d); } }
Comments
Post a Comment