数据类型
public class primitivetype{
public static void main(String[] args){
//整数 默认是int
byte num1 = 10; //-128~127 1字节
short num2 = 20; //-2^15~2^15-1 2字节
int num3 = 30; //-2^31~2^31-1 4字节
long num4 = 40L; //long类型要在数字后加L/l 8字节
//浮点数
float num5 = 50.1F; //float类型要在数字后加F/f 4字节
double num6 = 3.1415926; //小数默认是double类型 8字节
//字符
char name = '中'; //只能输入两个字节
String name = "中国"; //字符串String不是关键字,是类
//布尔值 占1位
boolean flag1 = true;
boolean flag2 = false;
}
}