注重這段代碼:
public class Demo{public static void main(String[] args)
{
MyRunnable r=new MyRunnable();
new Thread(r).start();// Thread one
r.cache=false;
new Thread(r).start();// Thread two
}
}
class MyRunnable implments Runnable {
boolean cache=true;
public void run()
{
while(true)
{
if(cache)
新聞熱點
疑難解答