Thursday, June 14, 2018

WAP IN JAVA TO SHOW THE TYPE CASTING

public class Third {
    public static void main(String args[])
    {
        int i,n=257;
        byte b;
        double d=556.76;
        System.out.println("conversion of integer to byte");
        b=(byte)n;
        System.out.println("n and b "+n+" "+b);
        System.out.println("conversion of double to integer");
        i=(int)d;
        System.out.println("d and i "+d+" "+i);
    }
}

                            
OUTPUT



No comments:

Post a Comment