package _10_代码块._02_初始化代码块;

public class Student {
    private String name;
    private int age;
    //初始化代码块当中去做初始化
    static {
        System.out.println("这是静态代码块");
    }

    {
//        this.name = "默认名称";
//        this.age = 1;
        System.out.println("这是初始化代码块执行");
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Student() {
        this("默认名称",1);
    }

    public Student(String name, int age) {
        System.out.println("这是全参数构造器");
        this.name = name;
        this.age = age;
    }
}
