class B implements A, Runnable { private String name;

public B(String name) {
    this.name = name;
    Thread thread = new Thread(this, name);
    thread.start();
}

@Override
public void run() {
    a();
}

@Override
public void a() {
    System.out.println('这是第16周');
}

}

interface A { void a(); }

Java多线程编程:实现接口A的类B并启动线程

原文地址: https://www.cveoy.top/t/topic/okiZ 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录