can u help with this stopwatch? I want that after writting "0" program will end. Stopwatch is working but i dont now how to stop. Thank for your answer.
package stopky;
import java.util.Scanner;
public class Stopky {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner (System.in);
System.out.println("Stlačte 0 pre začatie stopiek."); // "Press 0 for start
int start=sc.nextInt();
if (start==0) {
for(int hodiny = 0; hodiny < 24; hodiny++) //hours
{
for(int minuty = 0; minuty < 60; minuty++) //minutes
{
for(int sekundy = 0; sekundy < 60; sekundy++) //seconds
{
for(int ms = 0; ms < 1000; ms++) //miliseconds
try {Thread.sleep(1);} catch (Exception e) {}
{
System.out.println(hodiny + ":" + minuty + ":" + sekundy );
}
}
}
}
}
sc.close();
}
}