public class ThreadTest
public static void main(String[] args) {
Runnable r=new HelloThread()
Thread t
//r=new HelloThread()
Thread t
t
t
}
}
class HelloThread implements Runnable
{
int i; //成員變量
@Override
public void run() {
int i=
while(true){
System
try {
Thread
} catch (InterruptedException e) {
e
}
if(i==
break;
}
}
}
}
From:http://tw.wingwit.com/Article/program/Java/gj/201311/27399.html