问题是使用线程生成1到99之间的随机数.不过这里的问题是我不知道"主要线程停止"从何而来?主线是不是最终死了?
这是示例输出:
Main thread stopping
Random no = 57
Random no = 47
Random no = 96
Random no = 25
Random no = 74
Random no = 15
Random no = 46
Random no = 90
Random no = 52
Random no = 97
Thread that generates random nos is stopping
Run Code Online (Sandbox Code Playgroud)
神话类:
public class MyThread extends Thread {
MyThread() {
// default constructor
}
MyThread(String threadName) {
super(threadName); // Initialize thread.
start();
}
public void run() {
// System.out.println(Thread.currentThread().getName()); …Run Code Online (Sandbox Code Playgroud)