第24章 Java 数据类型转换

Java56

井底点灯深烛伊,共郎长行莫围棋。

What we call "failure" is not falling down, but the staying down.

所谓"失败"不是跌倒,而是就此躺平。

数据类型转换分为自动转换和强制转换。自动转换是\

[En]

Data type conversion is divided into automatic conversion and forced conversion. Automatic conversion is a

从低到高执行自动转换。不同类型数据之间的优先级关系如下:

[En]

Automatic conversion is performed from low to high. The priority relationship between different types of data is as follows:

低--------------------------------------------->高
byte,short,char-> int -> long -> float -> double

在操作中,首先将不同类型的数据转换为相同类型,然后执行操作。转换规则如下:

[En]

In the operation, different types of data are first converted to the same type, and then the operation is performed. The conversion rules are as follows:

操作数1类型 操作数2类型 转换后的类型

byte、short、char int int byte、short、char、int long long byte、short、char、int、long float float byte、short、char、int、long、float double double

输入验证码查看隐藏内容

扫描二维码关注本站微信公众号 Johngo学长
或者在微信里搜索 Johngo学长
回复 svip 获取验证码
wechat Johngo学长