public class san
{
public static void main(String[] args)
{
byte b;
int i=300;
long l=8000;
double d=325.561;
System.out.println("Conversion of int to byte.");
b=(byte)i;
System.out.println("i and b"+i+""+b);
System.out.println("Conversion of int to long.");
l=i;
System.out.println("i and l"+i+""+ l);
long lo=8000;
System.out.println("Conversion of int to int.");
i=(int)lo;
System.out.println("i and lo"+i+""+lo);
System.out.println("Conversion of int to int.");
i=(int)d;
System.out.println("d and i"+d+""+i);
System.out.println("Conversion of int to byte.");
b=(byte)d;
System.out.println("d and b"+d+""+b);
}
}
【san】
于 2022-04-16 23:31:10 首次发布