变量
public class Demo05 {
//属性:变量
//实例变量:从属于对象;如果不自行出事化,这个类型的默认值 0 0.0
//布尔值:默认是false
//除了基本类型,其余的默认值都是null
String namo;
int age;
//main方法
public static void main(String[] args) {
//局部变量:必须声明和初始化值
int i = 10;
System.out.println(i);
//变量类型 变量名字 =new Demo08()
Demo05 damo05 = new Demo05();
System.out.println(Demo05.age);
System.out.println(Demo05.name);
//类变量 static
System.out.println(salary);
}
}
//其他方法
public void app(){
}
}
常量
public class demo06 {
static final double PI = 3.14;
public static void main(String[] args) {
System.out.println(PI);
}
}