Task.java 226 B

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