YourPaste - For your paste! Archive - Tools - Login

thread example

Posted by unknown on Sun 3 Feb 2008 17:48 1186 views - Syntax: Java - Expires: never - Report - IMG - Download -

  1. public class voorbeeld {
  2.     public static void main(String[] args) {
  3.         /** we maken een nieuwe instantie van newThread **/
  4.         new newThread();
  5.  
  6.         System.out.println("Dit is de main thread");
  7.     }
  8. }
  9.  
  10. /** Thread class **/
  11. class newThread implements Runnable {
  12.     public newThread()
  13.     {
  14.         /** We maken hier in de constructor de nieuwe thread. **/
  15.         new Thread(this).start();
  16.     }
  17.  
  18.     /** Deze method word aangeroepen als de thread gestart word **/
  19.     public void run() {
  20.         System.out.println("Dit is de nieuwe thread");
  21.     }
  22. }

Comments


Name:
Comment:

© 2008 YourPaste.net - Disclaimer