数据类型 变量名称 ;
int num ;
num = 20;
初始化
int num2 = 30;
package lessen1;
public class Day2 {
public static void main(String[] args) {
// 字符类型
char sex = '男';
System.out.println(sex);
// 整数 byte short int long 默认 int 类型
byte num = 127;
System.out.println(num);
short num1 = 30000;
System.out.println(num1);
int num2 = 20000000;
System.out.println(num2);
long num3 = 240000000000l;
System.out.println(num3);
// 浮点型 double float 默认 double
double num4 = 9.123456789; // 9.123456789
System.out.println(num4);
float num5 = 8.123456123f;
System.out.println(num5); // 8.123456
}
}