温馨提示×

byte java中如何转换为其他类型

小樊
99
2024-07-05 21:40:18
栏目: 编程语言

  1. 将byte转换为int:
byte b = 10;
int i = b;
  1. 将byte转换为long:
byte b = 10;
long l = b;
  1. 将byte转换为float:
byte b = 10;
float f = b;
  1. 将byte转换为double:
byte b = 10;
double d = b;
  1. 将byte转换为char:
byte b = 10;
char c = (char) b;

0