Een thread maken met implements

  • public class ThreadVb2 implements Runnable
    {
       public ThreadVb2()
       {
       }
       public void run()
       {
          int t = 0;
          while (true)
          {
             System.out.println("th2 " + t + "\n");
             t++;
          }
       }
       static public void main(String[] args)
       {
          Thread th = new Thread(new ThreadVb2());
          th.start();
          int t = 0;
          while (true)
          {
             System.out.println("th1 " + t + "\n");
             t++;
          }
       }
    }