How to display thread in 100 lines, each line length of 100 characters ?
public class CustomThread extends Thread{
private Thread t;
private String threadName;
CustomThread( String threadName){
this.threadName = threadName;
System.out.println("Creating " + threadName );
}
public void run() {
System.out.println("Running " + threadName );
try {
for(int i = 0; i < 100; i++) {
for (int j = 0; j < 100; j++) {
System.out.println(threadName);
Thread.sleep(50);
}
System.out.println("\n");
}
} catch (InterruptedException e) {
System.out.println("Thread " + threadName + " interrupted.");
}
System.out.println("Thread " + threadName + " exiting.");
}
public void start ()
{
System.out.println("Starting " + threadName );
if (t == null)
{
t = new Thread (this, threadName);
t.start ();
}
}
}
How to display 100 lines, when each line length of 100 characters.
My main:
public class Main {
public static void main(String[] args) {
CustomThread T1 = new CustomThread("1");
T1.start();
}
}
This character is "1". But how to display 100 lines on 100 characters, that thread ? My code is not work.