class DispTask extends Thread { boolean doYield; String mark; DispTask(boolean _doYield, String _mark) { doYield = _doYield; mark = _mark; } public void run() { for (int i = 0; i < 10; i++) { System.out.println(i + ">" + mark); if (doYield) yield(); } } }