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ǒ愛伱--咾婆 閱讀(224) 評論(0)  編輯  收藏 所屬分類: JavaCode

          導航

          統計

          公告

          芳兒寶貝.我愛你


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


           最近在讀的書:

          常用鏈接

          留言簿(1)

          隨筆分類(37)

          JavaCode

          搜索

          積分與排名

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 衡水市| 武冈市| 松潘县| 科尔| 乌拉特中旗| 林甸县| 黎平县| 杭锦旗| 福建省| 云南省| 和政县| 木兰县| 宁津县| 社旗县| 眉山市| 新竹县| 延边| 大宁县| 新巴尔虎左旗| 焦作市| 安乡县| 宜章县| 万安县| 公主岭市| 内丘县| 永平县| 日照市| 伊金霍洛旗| 平利县| 邹平县| 宣化县| 武冈市| 特克斯县| 九江市| 江川县| 南投县| 阿尔山市| 中西区| 土默特左旗| 台前县| 白玉县|