라인 이해 2

983 단어 thread

package theard;

public class MyThread1 extends Thread {
	 
	static int num=0;
	  public static void main(String args[]) 
	  {
	     Thread t= Thread.currentThread(); 
	     System.out.println("    : "+t.getName());
	     System.out.println("--------------");
	     MyThread1 ex = new MyThread1();
	     ex.start();
	     
	     MyThread1 ex2 = new MyThread1();
	     ex2.start(); 
	     
	     MyThread1 ex3 = new MyThread1();
	     ex3.start();
	     
	     MyThread1 ex4 = new MyThread1();
	     ex4.start();
	     
	     MyThread1 ex5 = new MyThread1();
	     ex5.start();
	  }
	  public void run() {
	     System.out.println("    :"+this);
	     System.out.println("do something:"+num++);
	     System.out.println("--------------");
	  }
	}

좋은 웹페이지 즐겨찾기