大家好,又见面了,我是你们的朋友全栈君。
一.将long型转化为int型,这里的long型是基础类型:
long a = 10; int b = (int)a;
二.将Long型转换为int 型的,这里的Long型是包装类型:
Long a = 10; int b=a.intValue();
三.将int型转化为long型,这里的int型是基础类型:
int a = 10;long b = (long)a;
四.将Integer型转化为long型,这里的Integer型是包装类型:
Integer a = new Integer(10); long b = a.longValue();
转载于: https://www.cnblogs.com/zhangzongle/p/5866594.html
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/134746.html原文链接:https://javaforall.cn