шпаргалки
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
983 B

2 years ago
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mt;
/**
*
* @author (C)Y.D.Zakovryashin, 09.01.2023
*/
public class SimpleThread implements Runnable {
private char c;
private int num;
public SimpleThread(char c, int num) {
this.c = c;
this.num = num;
}
@Override
public void run() {
for (int i = 0; i < num; ++i) {
System.out.print("-" + c);
// try {
// Thread.currentThread().sleep(500);
// } catch (InterruptedException e) {
// System.out.println("Thread \""
// + Thread.currentThread().getName()
// + "\" is interrupted");
// }
}
System.out.println();
}
public Thread getThread () {
return Thread.currentThread();
}
}