Newer
Older
test001 / TestThread.java
@Motoki Miura Motoki Miura on 7 Aug 2020 769 bytes java files
// File: TestThread.java
import java.io.* ;

//-----------------------------------------------------------
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�~���b����x�~
			} catch(InterruptedException e) {
				break;
			}
		} // end while
	} // end of run
} // end of class myThread