class RunnableImpl implements Runnable{
public void run(){
for(int i=0;i<100;i++){
if(i==50){
try{
Thread.sleep(1000);
}
catch(Exception e){
System.out.println(e);
}
}
System.out.println("RunnableImpl-->"+i);
}
}
}
class Test{
public static void main(String args[]){
RunnableImpl ri=new RunnableImpl();
Thread t=new Thread(ri);//將ri作爲參數傳給Thread
t.setPriority(9);//設置優先級爲9
t.start();
System.out.println(t.getPriority());//獲取優先級
}
}