包装类和基础类的类型转换

一.将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 = (int)a;

四.将Integer型转化为long型,这里的Integer型是包装类型:

int a = 10;Long b = a.longValue();

 

 

 

 

 

 

 

String 和int  Integer

https://blog.csdn.net/hglhjh/article/details/80342701

 

posted @ 2022-01-07 18:08  11111ghm  阅读(147)  评论(0编辑  收藏  举报