## 变量
![image-20221216143633096](C:\Users\biao\AppData\Roaming\Typora\typora-user-images\image-20221216143633096.png)
![image-20221216144807423](C:\Users\biao\AppData\Roaming\Typora\typora-user-images\image-20221216144807423.png)
## 常量
![image-20221216150819999](C:\Users\biao\AppData\Roaming\Typora\typora-user-images\image-20221216150819999.png)
![image-20221216152142301](C:\Users\biao\AppData\Roaming\Typora\typora-user-images\image-20221216152142301.png)
public class Demo04 {
public static void main(String[] args) {
//int a,b,c;
//int a=1,b=2,c=3; //程序可读性
int a = 1;
int b = 2;
int c = 3;
String name = "fangbiao";
char x = 'x';
double pi = 3.14;
}
}
public class Demo05 {
//类变量 static
static double salary = 3000;
//属性:变量
//实例变量:从属于对象;如果不自行初始化,这个类型的默认值 0 0.0
//布尔值:默认是false
//除了基本类型,其余的默认值都是null;
String name;
int age;
//main方法
public static void main(String[] args) {
//局部变量;必须声明和初始化值
int i = 10;
System.out.println(i);
//
Demo05 demo05 = new Demo05();
System.out.println(demo05.age);
System.out.println(demo05.name);
System.out.println(salary);
}
//其他方法
public void add(){
}
}
public class Demo06 {标签:day08,int,image,System,static,public,out From: https://www.cnblogs.com/biao3/p/16987570.html
//修饰符,不存在先后顺序
static final double PI = 3.14;
public static void main(String[] args) {
System.out.println(PI);
}
}