Bapa

Untitled

Mar 17th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.66 KB | None | 0 0
  1. class MyThread extends Thread
  2. {
  3.  public void run()
  4. {
  5.                       System.out.println("MyThread: run()");
  6. }
  7.  
  8. public void start()
  9. {
  10.   System.out.println("MyThread: start()");
  11. }
  12. }
  13.  
  14. class MyRunnable implements Runnable
  15. {
  16. public void run()
  17. {
  18.                      System.out.println("MyRunnable: run()");
  19. }
  20.  
  21. public void start()
  22. {
  23.   System.out.println("MyRunnable: start()");
  24. }
  25. }
  26.  
  27. public class MyTest
  28. {
  29. public static void main(String args[])
  30. {
  31.        MyThread  myThread  =  new MyThread();
  32.        MyRunnable myRunnable = new MyRunnable();
  33.       Thread thread  =  new Thread(myRunnable);
  34.       myThread.start();
  35.       thread.start();
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment