热门

最新

红包

立Flag

投票

同城

我的

发布
weixin_47949968
weixin_47949968
3 年前
trueweixin_47949968

好

非计算机专业校招直入阿里0到48W年薪,绝密学习路线+面试题分享

CSDN App 扫码分享
分享
评论
点赞
打赏
  • 复制链接
  • 举报
下一条:
第二章2.1强制类型转换package day1;public class ONE { public static void main(String[] args) { // TODO Auto-generated method stub 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 long to int."); i=(int)lo; System.out.println("i and lo"+i+" "+lo); System.out.println("Conversion of double to int."); i=(int)d; System.out.println("d and i"+d+" "+i); System.out.println("Conversion of double to byte."); i=(byte)d; System.out.println("d and b"+d+" "+b); }}结果Conversion of int to byte.i and b300 44Conversion of int to long.i and l300 300Conversion of long to int.i and lo8000 8000Conversion of double to int.d and i325.561 325Conversion of double to byte.d and b325.561 44
立即登录