static详解
package oop.demo05;
public class Student {
private static int age;
private double score ;
public void run(){
}
public static void go(){
}
public static void main(String[] args) {
go();
}
}
package oop.demo05;
public class Person {
{
System.out.println("匿名代码块");
}
static{
System.out.println("静态代码块");
}
public Person() {
System.out.println("构造方法");
}
public static void main(String[] args) {
Person person1 = new Person();
System.out.println("===================================");
Person person2 = new Person();
}
}
抽象类
笔记
![在这里插入图片描述](https://img-blog.csdnimg.cn/8ad2513213d4448188343b97919d50f5.png#pic_center)
特点
- 不能new这个抽象类,只能靠子类去实现他:是一种约束
- 抽象类里面可以写普通方法
- 抽象方法必须在抽象类中
- 抽象的抽象:约束