Code:
package lp_2018_02_09_01;
public class thread03 extends Thread {
private String threadName;
public thread03(String name) {
this.threadName = name;
}
public void run() {
while(true) {
System.out.println("This is " + this.threadName + " thread.");
}
}
}
package lp_2018_02_09_01;
public class thread04 implements Runnable {
private String threadName;
public thread04(String name) {
this.threadName = name;
}
public void paly() {
while(true) {
System.out.println(this.threadName);
}
}
@Override
public void run() {
this.paly();
}
}
Effect: