标识符:用户自己的命名
//整数
byte num1 = 111;
short num2 = 1111;
int num3 = 11111;
long num4 = 111111L;// L
//浮点数
float num5 = 1.1F;// F
double num6 = 1.1111111;
//字符
char name = ‘一‘;
//布尔值
boolean flag1 = false;
else:
类
接口
数组
强制类型转换
自动类型转换
要素:变量类型,变量名,作用域
类名:FlyingFish 首字母大写+驼峰
方法名:toFly() 首字母小写+驼峰
常量:MAX_FISH 大写
其他变量:redFish 首字母小写+驼峰
public class Demo1 {
static int a = 10;//类变量
int b = 10;//实例变量
public static void main(String[] args) {
int c = 10;//局部变量
}
}
public class Demo2 {
//static,final 属于修饰符,无先后顺序
static final float PI = 3.14F;
public static void main(String[] args) {
System.out.println(PI);
}
}
原文:https://www.cnblogs.com/FlyingFishStudio/p/15201456.html