Main.java 525 B

123456789101112131415161718192021222324252627
  1. public class Main {
  2. public static void main (String argv[]) {
  3. Thread tA, tB;
  4. boolean doYield = false;
  5. if (argv.length == 1) {
  6. if (argv[0].equals("true"))
  7. doYield = true;
  8. }
  9. else {
  10. System.err.println("Wrong number of arguments.");
  11. System.out.println("Usage : java Main true|false");
  12. return;
  13. }
  14. if (doYield)
  15. System.out.println("Do yield");
  16. else
  17. System.out.println("NOT do yield");
  18. tA = new DispTask(doYield, "tA");
  19. tB = new DispTask(doYield, "tB");
  20. tA.start();
  21. tB.start();
  22. }
  23. }