/* * 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(); } }