// Birden fazla Thread yaratılabilir. import java.util.*; public class MultiThreadTest implements Runnable { Thread t1, t2; public MultiThreadTest() { t1 = new Thread(this); t2 = new Thread(this); t1.start(); t2.start(); } public void run() { while (true) { try { Thread.sleep(1000); // Hangi Thread'in çalıştığı anlaşılabilir. if (Thread.currentThread() == t1) { System.out.println("thread 1 " + new Date()); } else if (Thread.currentThread() == t2) { System.out.println("thread 2 " + new Date()); } } catch (Exception e) { e.printStackTrace(); } } } public static void main(String[] args) { MultiThreadTest mt = new MultiThreadTest(); } }Dosyayı İndir