from the last level 16 with the introduction of threads the tasks now has become even more complex and long.
Well i just wanted to know what is the best way adapted to read such a long multiple file programs.
we Should go with main or move from one class to another .
package com.codegym.task.task17.task1712;
import java.util.ArrayList;
import java.util.List;
/*
Restaurant
*/
public class Restaurant {
public static List<Thread> threads = new ArrayList<>();
public static void main(String[] args) throws Exception {
Waiter waiterTarget = new Waiter();
Thread waiter = new Thread(waiterTarget);
threads.add(waiter);
Cook cookTarget = new Cook();
Thread cook = new Thread(cookTarget);
threads.add(cook);
waiter.start();
cook.start();
Thread.sleep(2000);
cookTarget.continueWorking = false;
Thread.sleep(500);
waiterTarget.continueWorking = false;
}
}