Mercurial > hg > FederatedLinda
view src/fdl/old/test2/CountTest.java @ 114:3b877c9a44f5
gather old packages
author | kazz |
---|---|
date | Mon, 11 Oct 2010 14:29:37 +0900 |
parents | src/fdl/test2/CountTest.java@629b6cfbd37f |
children |
line wrap: on
line source
package fdl.old.test2; class CountA implements Runnable { public void run() { for (int i=0; i <= 5; i++) { System.out.println("A: " + i); } } } class CountB implements Runnable { public void run() { for (int i=5; i >= 0; i--) { System.out.println(" B: " + i); } } } class CountTest { public static void main(String[] args) { // ランナブルクラスのインスタンス化 CountA runA = new CountA(); CountB runB = new CountB(); System.out.println("Runnable Class のインスタンス化終了"); // スレッドのインスタンス化 Thread threadA = new Thread(runA); Thread threadB = new Thread(runB); System.out.println("Thread へ受け渡し終了"); // スレッドの開始 threadA.start(); threadB.start(); System.out.println("Thread の start() 終了"); System.out.println("適時自動的に run() が実行される"); } }