Task.java 283 B

123456789101112131415161718
  1. class DispTask extends Thread {
  2. boolean doYield;
  3. String mark;
  4. DispTask(boolean _doYield, String _mark) {
  5. doYield = _doYield;
  6. mark = _mark;
  7. }
  8. public void run() {
  9. for (int i = 0; i < 10; i++) {
  10. System.out.println(i + ">" + mark);
  11. if (doYield)
  12. yield();
  13. }
  14. }
  15. }