Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

public class CompteRebour extends Thread { public int h; public int min; public int sec; public CompteRebour(int

h, int min, int sec){ this.sec=sec; this.min=min; this.h=h; } public void run(){ while(true){ Thread tt = new Thread(); tt.start(); String Temps =min+":"+sec; System.out.println(Temps); try { tt.sleep(1000); } catch (InterruptedException e) { System.out.println("erreur"); } if ((sec == 0) && (min != 0)) { sec = 59; min--; }else if ((sec == 0) && (min == 0)) { System.out.print("termin !!!"); } sec--; } } public static void main(String[] args){ new CompteRebour(0,1,5).start(); } }

You might also like