> For the complete documentation index, see [llms.txt](https://298073941.gitbook.io/memo/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://298073941.gitbook.io/memo/2020-05/java-ji-chu-1/shu-ju-zhuan-huan.md).

# 数据转换

java存在多种数值类型，所以会涉及数据转换

### 隐式转换

由小变大

byte、char、short->int->long->float->dubbo 自动提升

![](/files/-M6DUauP4hBG1ravgyIj)

### 显示强转

数据可能会溢出

![](/files/-M6DUtetdQUvO-_ZdnRi)

### 数据装包和拆包

java 基本类型有个缺点就是无法为空，所以在平时程序运行时候可能会使用其他的类型来代替，如Integer对象来代替int

Integer在碰到+-的时候会自动拆解成int类型,可能会发生空指针异常

接口调用入参含有Integer，可以传递int类型，会自动包装成Integer
