20170324问题解析请点击今日问题下方的“【Java每日一题】20170327”查看(问题解析在公众号首发,公众号ID:weknow619)
package Mar2017; public class Ques0327 { public static void main(String[] args) {
MyThread t1 = new MyThread("t1");
MyThread t2 = new MyThread("t2");
t1.start();
t2.start();
}
} class MyThread extends Thread {
public void output(String s) {
System.out.println(s);
} public void run() {
for (int i = 0; i < 10; ++i) {
try {
sleep((long)(3000*Math.random()));
} catch (Exception e) {
// TODO: handle exception
}
output(getName());
}
} public MyThread(String s) {
super(s);
}
}
今日问题:
请问主程序运行结果是什么?(点击以下“【Java每日一题】20170327”查看20170324问题解析)
题目原发布于公众号、简书:【Java每日一题】20170327,【Java每日一题】20170327 (也可以扫描头像二维码查看)