public class example03 {
public static void main(String[] args) {
//-128到127 占一个字节
byte b = 5;
//占两个字节
short a = 100;
//占四个字节 整数默认的数据类型是int类型
int i = 200;
//占八个字节 如果long类型后边加L进行标识 添加大写的L
long d = 400;
System.out.println(b);
System.out.println(a);
System.out.println(i);
System.out.println(d);
// 浮点类型
//占四个字节
//float f = 12.3f或者float f = (float)12.3
float f = 12.3f;
//占八个字节 小数默认数据类型
double s = 10.22;
System.out.println(f);
System.out.println(s);
//字符类型
char c = 'a';
System.out.println(c);
//布尔类型
boolean b1 = true;
boolean b2 = false;
System.out.println(b1);
System.out.println(b2);
}
public static void main(String[] args) {
//-128到127 占一个字节
byte b = 5;
//占两个字节
short a = 100;
//占四个字节 整数默认的数据类型是int类型
int i = 200;
//占八个字节 如果long类型后边加L进行标识 添加大写的L
long d = 400;
System.out.println(b);
System.out.println(a);
System.out.println(i);
System.out.println(d);
// 浮点类型
//占四个字节
//float f = 12.3f或者float f = (float)12.3
float f = 12.3f;
//占八个字节 小数默认数据类型
double s = 10.22;
System.out.println(f);
System.out.println(s);
//字符类型
char c = 'a';
System.out.println(c);
//布尔类型
boolean b1 = true;
boolean b2 = false;
System.out.println(b1);
System.out.println(b2);
}
}