Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MyThread extends Thread
- {
- String myName;
- MyThread(String name)
- {
- myName = name;
- }
- public void run()
- {
- for(int i=0; i<100;i++)
- {
- System.out.println(myName);
- }
- }
- public static void main(String args[])
- {
- try
- {
- MyThread mt1 = new MyThread("mt1");
- MyThread mt2 = new MyThread("mt2");
- mt1.start();
- // XXX
- mt2.start();
- }
- catch(InterruptedException ex)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment