本帖最后由 丁强强 于 2013-1-18 04:49 编辑
- class lianxi
- {
- public static void main(String[] args)
- {
- Demo d1 = new Demo("0号窗口");
- Demo d2 = new Demo("1号窗口");
- Demo d3 = new Demo("2号窗口");
- Demo d4 = new Demo("3号窗口");
- d1.start();
- d2.start();
- d3.start();
- d4.start();
- }
- }
- class Demo extends Thread
- {
- private String name;
- Demo(String name)
- {
- this.name = name;
- };
- private static int piao = 100;
- public void run()
- {
- for (;0<piao && piao<=100 ;piao--)
- {
- System.out.println(name+" 第"+piao+"张");
- }
- };
- }
复制代码 |
|