Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MyThread extends Thread
- {
- public void run()
- {
- System.out.println("MyThread: run()");
- }
- public void start()
- {
- System.out.println("MyThread: start()");
- }
- }
- class MyRunnable implements Runnable
- {
- public void run()
- {
- System.out.println("MyRunnable: run()");
- }
- public void start()
- {
- System.out.println("MyRunnable: start()");
- }
- }
- public class MyTest
- {
- public static void main(String args[])
- {
- MyThread myThread = new MyThread();
- MyRunnable myRunnable = new MyRunnable();
- Thread thread = new Thread(myRunnable);
- myThread.start();
- thread.start();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment