这节课看视频就行

相关代码

package com.xf2021.Demo1;

public class Student {
    //以下按照优先级来写
    static {
        //类被加载时被同时加载,只执行一次
        System.out.println("静态代码块");
    }
    //以下为对象被创建时才会加载
    {
        //匿名代码块:赋初始值
        System.out.println("匿名代码块");
    }

    public Student() {
        System.out.println("构造方法");
    }

    public static void main(String[] args) {
        Student student = new Student();
        

    }
}

You got to put the past behind you before you can move on.