线程/static 为什么main打出来有日志/ ft1方法没日志
public static void main(String[] args) {
// 一边吃饭一边喝酒
new EatThread().start();
new DrinkThread().start();
System.out.println(ZonedDateTime.now().minusYears(1)+"大明王朝");
}
static class EatThread extends Thread {
@Override
public void run() {
System.out.println("开始吃饭🍚...\t" + ZonedDateTime.now());
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("结束吃饭🍚...\t" + ZonedDateTime.now());
}
}
static class DrinkThread extends Thread {
@Override
public void run() {
System.out.println("开始喝酒🍺...\t" + ZonedDateTime.now());
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("结束喝酒🍺...\t" + ZonedDateTime.now());
}
}