import java.io.IOException; import java.util.Timer; public class CheckTimer { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Timer timer = new Timer(); timer.schedule(new MyTask(), 1000,2000); System.out.println("hello"); } static class MyTask extends java.util.TimerTask { @Override public void run() { // TODO Auto-generated method stub System.out.println("____refresh 2 second____"); } } }