以下是个大概的流程public YourThread extends Thread
{
public void run()
{
while(true)
{
try
{
Encrypt.Check();
Thread.sleep(1000);
}
}
}
}
{
public void run()
{
while(true)
{
try
{
Encrypt.Check();
Thread.sleep(1000);
}
}
}
}
public void run(){
while(true){
Encrypt.Check();//执行方法放在死循环中
Thread.sleep(5000);//五秒
}
}
}//主方法
public static void main(String[] args){
//Your code here
//Start YourThread
Thread t=new YourThread();
t.start(); //like this OK!
//Your code here
}