package j1;
//-----------------------------------------------------------
public class TestThread{
public static void main(String[] args){
System.out.print("TestThread");
myThread mt1 = new myThread("1 ", 1300);
myThread mt2 = new myThread("2 ", 2900);
mt1.start();
mt2.start();
}
};
//-----------------------------------------------------------
class myThread extends Thread {
String s;
int t;
myThread(String s, int t) {
this.s = s;
this.t = t;
}
public void run() {
while(true) {
try {
System.out.print(this.s);
sleep(t); // tミリ秒動作休止
} catch(InterruptedException e) {
break;
}
} // end while
} // end of run
} // end of class myThread