学习了关于线程的一些教程,对线程基本了解。
但需要实例来贯彻一下,进一步掌握线程的机制和技巧。
哪位朋友有线程程序的源码能否帮忙一下,谢谢了!
(不要很大的软件源码,太长看不了,一般的就行,比如简单的聊天程序等等)
[email protected]
如果发到我邮箱的请跟贴说明一下,今晚回去后结贴!分不多,请见谅,谢谢各位!

解决方案 »

  1.   

    tij里面很多啊 ,随便抄一个:
    public class SimpleThread extends Thread {
      private int countDown = 5;
      private int threadNumber;
      private static int threadCount = 0;
      public SimpleThread() {
        threadNumber = ++threadCount;
        System.out.println("Making " + threadNumber);
      }
      public void run() {
        while(true) {
          System.out.println("Thread " + 
            threadNumber + "(" + countDown + ")");
          if(--countDown == 0) return;
        }
      }
      public static void main(String[] args) {
        for(int i = 0; i < 5; i++)
          new SimpleThread().start();
        System.out.println("All Threads Started");
      }
    }
      

  2.   

    core java里面也有一些
    网上随便搜索好了
    或者去sf上面下一些源码来看