002数据类型与进制转换

数据类型

数据类型分为:基本类型和引用类型

基本类型

整数类型:byte(1字节)、short(2字节)、int(4字节)、long(8字节)

浮点数类型:float(4字节)、double(8字节)

字符类型:char(2字节)

布尔类型:boolean

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

byte、char、short类型相加时需要转为int类型接收,int类型以下的类型需要以int类型大小为准

使用long类型赋值时结尾以l或L结尾;使用float类型赋值时结尾以f或F结尾

基本数据类型(除boolean),由低转高是自动转换,由高转低是强制转换

引用类型

类、接口、数组

String属于引用类型,属于类

进制换算

image-20210109143926492

image-20210109144222140

image-20210109144712381

image-20210109144736038

image-20210109150356213

image-20210109151231676

image-20210109151326193

image-20210109151437456

image-20210109185740870

posted @ 2021-01-16 08:58  Py-JS  阅读(74)  评论(0编辑  收藏  举报