I'm new to java, and I'm trying to practice building nested loop.
I want the following print result:
it is now 00:00:00
it is now 00:00:01
it is now 00:00:02
it is now 00:00:03
...
it is now 11:59:59
so you see the point. It's a dumb simulation of a superfast clock
The problem is it starts with:
it is now 10 : 55 : 46
it is now 10 : 55 : 47
it is now 10 : 55 : 48
...and not with 00 : 00 : 00
So far here are my codes:
public class Example {
public static void main(String[] args)
{
int h = 0;
while(h<=11)
{
int m = 0;
while(m<=59)
{
for(int s=0; s<=59;s++)
{
System.out.println("it is now " + h + " : " + m + " : " + s );
}
m++;
}
h++;
}
}
Any help will be greatly appreciated! Sylvain
hmsto test it