Methode run() in Printer.java korrigiert.

This commit is contained in:
romanschenk37 2022-03-03 13:48:29 +01:00
parent 662dbdd021
commit 2e7bf12166
1 changed files with 2 additions and 1 deletions

View File

@ -15,6 +15,7 @@ public class Printer {
private static class PrinterThread extends Thread {
char symbol;
int sleepTime;
Thread current_thread = this;
public PrinterThread(String name, char symbol, int sleepTime) {
super(name);
@ -24,7 +25,7 @@ public class Printer {
@Override
public void run() {
if(Thread.currentThread().getName().equals("main")){
if(Thread.currentThread() != current_thread){
return;
}
System.out.println(getName() + " run started...");