package com.thread.normal;
public class NormalThreadTest {
public static void main(String[] args) throws Exception {
long start = System.currentTimeMillis();
ShoppingThread shopping = new ShoppingThread();
shopping.start();
shopping.join();
KitchenWare kc = shopping.kc;
FoodMateral fm = new FoodMateral();
Thread.sleep(2000);
System.out.println("第二步: 食材已经到位");
cooking(kc, fm);
System.out.println("第三步:美食烹饪完成");
long end = System.currentTimeMillis();
System.out.println("烹饪美食时间为》"+(end-start));
}
static class ShoppingThread extends Thread{
private KitchenWare kc;
@Override
public void run() {
System.out.println("第一步:网上下单");
System.out.println("第一步:等待厨具");
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("第一步:快递到货");
kc = new KitchenWare();
}
}
static class KitchenWare {
}
static class FoodMateral{
}
static void cooking(KitchenWare kc,FoodMateral fm){
}
}