扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
我就废话不多说了,大家还是直接看代码吧~
public static void main(String[] args) { // 1、将long型转化为int型,其中int、long是基础类型 long a = 10; int b = (int) a; System.out.println("1、将long型转化为int型:" + b); // 2、将int型转化为long型,其中int、long都是基础类型 int a1 = 10; long b1 = a1; System.out.println("2、将int型转化为long型:" + b1); // 3、将Long型转换为int型的,其中Long型是包装类型 Long a2 = 10l; int b2 = a2.intValue(); System.out.println("3、将Long型转换为int型:" + b2); //4、将Integer型转化为long型,其中Integer型是包装类型,long型是基础类型 Integer a3=10; long b3=a3.longValue(); System.out.println("4、将Integer型转化为long型:"+b3); //5、将Integer型转化为Long型,其中Integer、Long型都是包装类型 Integer a4=10; Long b4=a4.longValue(); System.out.println("5、将Integer型转化为Long型:"+b4); }
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流