Implement arduino like:delay() function in java


class aThread extends Thread{
public void run(){
for(int i=0; i<100; i++){
String threadName = Thread.currentThread().getName();
System.out.println(threadName + “: “ + i);
try{
Thread.sleep(1000);
}catch(Exception e){
System.out.println(“Sleep Error”);
}
}
}

}

作者

RongSon

Graduate Student of CCU COMM Game Development, Network Communication, macOS/Ubuntu/Android, Arduino/Raspberry Pi/Intel Edison, Java/Python/C/C++

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *