Check out example codes for "faire un timer en java". It will help you in understanding the concepts better.

Code Example 1

 
 import java.lang.*;
 import java.awt.*;
 import javax.swing.*;
 import javax.swing.border.*;
 import java.awt.event.*; 
 
public class Main {
 
	private static int heure=0,minute=0,seconde=0;
 
	public static void main(String[] args) {
 
		   /* Le timer */
		  int delais=1000;
		  ActionListener tache_timer;
 
		  /* Action réalisé par le timer */
		  tache_timer= new ActionListener()
		  {
		  public void actionPerformed(ActionEvent e1)
		  {
		  seconde++;
		  if(seconde==60)
		  {
		  seconde=0;
		  minute++;
		  }
		  if(minute==60)
		  {
		  minute=0;
		  heure++;
		  }
		  System.out.println(heure+":"+minute+":"+seconde);
		  }
		  };
 
		  /* instanciation du timer */
		  final Timer timer1= new Timer(delais,tache_timer);
		  timer1.start();
 
	}
 
}

Learn ReactJs, React Native from akashmittal.com