主线程运行解析
2018-03-07 本文已影响0人
QinRenMin
代码段
class Demo{
private String name;
Demo(String name)
{
this.name = name;
}
public void show() {
for(int i = 0; i < 5; i++)
System.out.println(name+" i = "+i);
}
}
public class ThreadDemo {
public static void main(String[] args) {
Demo d1 = new Demo("demo1");
Demo d2 = new Demo("demo2");
d1.show();
d2.show();
System.out.println("Hello");
}
}
![](https://img.haomeiwen.com/i5656244/992f70159148512e.png)