一.Looper Looper对象,顾名思义,直译过来就是循环的意思,从MessageQueue中不断取出message. Class used to run a message loop for a thread. Threads by default do not have a message loop associated with them; to create one, call prepare() in the thread that is to run the loop, and…
定时器是一种特殊的多线程,使用Timer来安排一次或者重复执行某个任务 package org.zln.thread; import java.util.Date; import java.util.Timer; import java.util.TimerTask; /** * Created by coolkid on 2015/6/21 0021. */ public class TestTimerTask extends TimerTask { @Override public void…
import java.util.Timer; import java.util.TimerTask; public class Timer { .... public void schedule(TimerTask task, long delay) { .... } .... } public abstract class TimerTask implements Runnable { ... } 1. 使用匿名内部类 new Timer().schedule(new TimeTask(){…
Java java.util.Timer is a utility class that can be used to schedule a thread to be executed at certain time in future. Java Timer class can be used to schedule a task to be run one-time or to be run at regular intervals. Java TimerTask java.util.Tim…
1.for循环结构 for var in item1 item2 ... itemN do command1 command2 ... commandN done 例如,顺序输出当前列表中的数字: #!/bin/bash for loop in 1 2 3 4 5 6 do echo "the loop valus is :$loop" done 例如,顺序输出字符串中的字符: #!/bin/bash for str in 'This is a string' do echo $str…