www.baidu.com

          JavaCode--我愛你,芳兒

          JavaStudy--我愛你,芳兒

          關于線程學習打的代碼

          關于線程學習打的代碼 //by EditPlus
          class ThreadTest extends Thread
          {
              
          public void run()
              {
                  System.out.println(
          "the thread is running!");
              }
              
          public void run(String s)
              {
                  System.out.println(
          "thethread is :" + s);
              }
              
          public static void main(String[] args)
              {
                  ThreadTest threadTest1 
          = new ThreadTest();
                  Thread thread1 
          = new Thread(threadTest1);
                  thread1.start();
                  
          for(int i  = 0; i <= 1100; i++);
                  
          //when you write the i++,you should not write it like this:i ++..there is no space between the i and the ++!!be careful!
                  threadTest1.run("wo ai ni babe!");
              }

          }

          public class PingPong extends Thread
          {
              
          private String word;
              
          private int delay;
              
          public PingPong(String s,int i)
              {
                  word 
          = s;
                  delay 
          = i;
              }
              
          public void run()
              {
                  
          try 
                  {
                      
          forint i = 1; i <= 100; i++)
                      {
                          System.out.println(word 
          + "is what i want!");
                          Thread.sleep(delay);
                      }
                  }
                  
          catch(InterruptedException e)
                  {
                      
          return;
                  }
              }
              
          public static void main(String argv[])
              {
                  
          new PingPong("wo",30).start();
                  
          new PingPong("wod",100).start();
              }

          }


          public class ThreadTest1 implements Runnable
          {
              
          public ThreadTest1()
              {
                  System.out.print(
          "babe!");
              }
              
          public ThreadTest1(String s)
              {
                  System.out.print(
          "BABE " + s);
              }
              
          public void run()
              {
                  System.out.println(
          "what I want is your heart and your body!");
              }
              
          public static void main(String[] args)
              {
                  ThreadTest1 th 
          = new ThreadTest1();
                  Thread thread 
          = new Thread(th);
                  ThreadTest1 th1 
          = new ThreadTest1("Wjf");
                  Thread thread1 
          = new Thread(th1);
                  thread.start();
                  thread1.start();
              }
          }


           

          芳兒寶貝.我愛你

          posted on 2007-12-08 18:01 wǒ愛伱--咾婆 閱讀(221) 評論(0)  編輯  收藏 所屬分類: JavaCode

          導航

          統計

          公告

          芳兒寶貝.我愛你


          黑客基地
          http://www.hackbase.com
          全球最大的黑客門戶網站


           最近在讀的書:

          常用鏈接

          留言簿(1)

          隨筆分類(37)

          JavaCode

          搜索

          積分與排名

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 常熟市| 栖霞市| 谷城县| 宜城市| 安化县| 长兴县| 二连浩特市| 菏泽市| 玉屏| 沁水县| 光山县| 商河县| 高青县| 莫力| 兰州市| 会东县| 嘉峪关市| 茌平县| 神池县| 高要市| 河北区| 吉水县| 酒泉市| 和龙市| 雅安市| 治多县| 九台市| 鱼台县| 九龙县| 遂宁市| 酉阳| 淮安市| 博兴县| 宿州市| 茂名市| 中牟县| 上犹县| 怀仁县| 温泉县| 株洲市| 柳河县|