Created
May 31, 2021 18:05
-
-
Save muhomerdogu/addca6a8f4583704f19b6d18b81533dd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package thread; | |
public class KronometreThread implements Runnable { | |
private Thread thread; | |
private String threadName; | |
public KronometreThread(String threadName) { | |
this.threadName = threadName; | |
System.out.println("thread oluşturuluyor.."); | |
} | |
@Override | |
public void run() { | |
System.out.println("çalıştırılıyor." + threadName); | |
try { | |
for (int i = 0; i <= 10; i++) { | |
System.out.println(threadName + " :" + i); | |
Thread.sleep(1000); | |
} | |
} catch (InterruptedException e) { | |
e.printStackTrace(); | |
} | |
System.out.println("Thread bitti.."+threadName); | |
} | |
public void start() | |
{ | |
System.out.println("Thread nesnesi oluşmaktadır."); | |
if(thread!=null) | |
{ | |
thread=new Thread(this,threadName); | |
thread.start(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment