public class MultiThread implements Runnable{
private String threadName = "";
public static void main(String[] args){
MultiThread multiThread = new MultiThread();
multiThread.setName("TestThread");
new Thread(multiThread).start();
for(int i=0;i<10;i++){
new Thread(new MultiThread()).start(); //correct
//new Thread(new MultiThread()).run(); //error
//new MultiThread().run(); //error
}
System.out.println("OK");
char no1 = '①';
char no2 = (char)(no1 + 19);
System.out.println(no1);
System.out.println(no2);
}
public void run(){
try {
Thread.sleep(1000);
}catch(InterruptedException e) {
}
System.out.println(threadName + ":" + Thread.currentThread().getName());
}
public void setName(String threadName) {
this.threadName = threadName;
}
}