锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国产精品久久三区,91成人精品,粉嫩一区二区三区国产精品http://www.aygfsteel.com/zj474097500/articles/337512.html銈繪櫤鍐涖儫銈繪櫤鍐涖儫Mon, 08 Nov 2010 03:41:00 GMThttp://www.aygfsteel.com/zj474097500/articles/337512.htmlhttp://www.aygfsteel.com/zj474097500/comments/337512.htmlhttp://www.aygfsteel.com/zj474097500/articles/337512.html#Feedback0http://www.aygfsteel.com/zj474097500/comments/commentRss/337512.htmlhttp://www.aygfsteel.com/zj474097500/services/trackbacks/337512.html           1銆佷粠JDK鏂囨。涓彲浠ュ彂鐜癟hread綾誨疄闄呬笂涔熸槸瀹炵幇浜哛unnable錛?/span>                                

           2銆佺敤Thread緇ф壙鑰屾潵鐨勭嚎紼嬶紝涓涓嚎紼嬪簭瀵硅薄鍙兘鍚姩涓嬈★紝鏃犺璋冪敤澶氬皯閬峴tart錛堬級鏂規(guī)硶錛岀粨鏋滈兘鍙湁涓涓嚎紼嬶紱
                 娉細(xì)sart錛堬級鏂規(guī)硶鏄嬌璇ョ嚎紼嬪紑濮嬫墽琛岋紝java铏氭嫙鏈鴻皟鐢ㄨ綰跨▼鐨剅un錛堬級鏂規(guī)硶錛屼篃鍙互璋冪敤琚瓙綾昏鐩栧啓榪囩殑鏂規(guī)硶銆?br />
           3銆佸疄鐜癛unnable鎺ュ彛姣旂戶鎵縏hread綾葷殑濂藉錛氣憼閫傚悎澶氫釜鐩稿悓紼嬪簭浠g爜鐨勭嚎紼嬪幓澶勭悊鍚屼竴璧勬簮鐨勬儏鍐碉紝涔熻兘閬垮厤鐢變簬java
                                                                                              鍗曠嚎紼嬪鐞嗗甫鏉ョ殑灞闄愶紝鍗沖鐞嗘洿涓虹伒媧匯?br />                                                                                           鈶℃湁鍒╀簬紼嬪簭鐨勫仴澹э紝鑳藉疄鐜拌祫婧愮殑鍏變韓銆?br />


絎竴縐嶆柟寮忥細(xì)緇ф壙Thread綾?br />

class MyThread extends Thread{
 //綰跨▼寤惰繜鏃墮棿
 private int time;
 //綰跨▼鐨勫悕瀛楃敱Thread绱嚜琛岀鐞?br />  public MyThread(String name,int time){
  //璋冪敤Thread綾諱腑鐨勬瀯閫犳柟娉曪紝璁劇疆綰跨▼鐨勫悕瀛?br />   super(name);
  this.time=time;
 }
 public void run(){
  for(int i=0;i<10;i++){
   try {
    Thread.sleep(this.time);
   } catch (InterruptedException e) {
    e.printStackTrace();
   }
   this.printMsg();
  }
 }

 public void printMsg(){
  System.out.println (Thread.currentThread().getName()+"-->***姝e湪榪愯***"+this.time+"縐?);
 }
}
public class Demo {
 public static void main(String[] args){
  MyThread mt = new MyThread("AA",100);
  MyThread mt1 = new MyThread("BB",200);
  MyThread mt2 = new MyThread("CC",300);
  
  mt.start();
  mt1.start();
  mt2.start();
 }
}

榪愯緇撴灉錛?img border="0" alt="" src="http://www.aygfsteel.com/images/blogjava_net/zj474097500/r.png" width="450" height="549" />



絎簩鏂瑰紡錛氬疄鐜癛uanable鎺ュ彛

class MyThread1 implements Runnable{
 private String name;
 private int time;
    public MyThread1(String name,int time){
     this.name= name;
     this.time=time;
    }
 public void run(){
  for(int i=0;i<10;i++){
   try {
    Thread.sleep(this.time);
   } catch (InterruptedException e) {
    e.printStackTrace();
   }
   this.printMsg();
  }
 }
 public void printMsg(){
  System.out.println (this.name+"-->***姝e湪榪愯***"+this.time+"縐?);
 }
}
public class DemoF {
 public static void main(String[] args){
  MyThread mt = new MyThread("AA",100);
  MyThread mt1 = new MyThread("BB",200);
  MyThread mt2 = new MyThread("CC",300);
  
  mt.start();
  mt1.start();
  mt2.start();
 }

}

榪愯緇撴灉錛氱被鍚屼簬涓婁竴縐嶆柟娉曠殑緇撴灉錛屽彧鏄嚭鐨勯『搴忎笉鐩稿悓



]]>
主站蜘蛛池模板: 旌德县| 通化县| 正阳县| 奉贤区| 玉环县| 奇台县| 垦利县| 五华县| 崇礼县| 含山县| 八宿县| 屏东市| 垦利县| 齐齐哈尔市| 扬州市| 荣成市| 宁远县| 襄樊市| 天全县| 大足县| 延津县| 铁力市| 嘉义县| 津市市| 昌都县| 商河县| 吉木萨尔县| 运城市| 道孚县| 黑龙江省| 伊吾县| 从江县| 肥乡县| 迭部县| 安丘市| 安陆市| 淳化县| 岚皋县| 新巴尔虎左旗| 荃湾区| 高尔夫|