Code example for Timer

Methods: cancel

0
    	timer.scheduleAtFixedRate(new TimerTask(){ public void run() {counter++;}}, 0, 1000L);
    } 
     
    private void shutdownCounter() { 
    	if (timer != null) {
    		timer.cancel();
    	} 
    } 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE