Q:

My clock code stops working at Ten O' Clock

My clock code works at every other hour except ten o' clock. At every other hour, it increments minutes by 1 every time seconds is 60, but at ten o' clock, for some reason, it increments minutes by 1 every time seconds is 10. I don't know what I did wrong. Please help!
package misk;

public class Misk {
   public static void main(String[] args) throws InterruptedException {
      int x = 0;
      int sec = 0, min = 0, hour = 9;
      while (x == 0) {
         Thread.sleep(10);
         sec++;
         if (sec == 60) {
            sec = 0;
            min++;
         }
         if (min == 60) {
            min = 0;
            hour++;
         }
         if (sec < 10) {
            if (min < 10) {
               if (hour < 10) {
                  System.out.println("0" + hour + ":0" + min + ":0" + sec);
               }
            }
         }
         if (sec > 10) {
            if (min < 10) {
               if (hour < 10) {
                  System.out.println("0" + hour + ":0" + min + ":" + sec);
               }
            }
         }
         if (sec < 10) {
            if (min > 10) {
               if (hour < 10) {
                  System.out.println("0" + hour + ":" + min + ":0" + sec);
               }
            }
         }
         if (sec < 10) {
            if (min < 10) {
               if (hour > 10) {
                  System.out.println("" + hour + ":0" + min + ":0" + sec);
               }
            }
         }
         if (sec > 10) {
            if (min > 10) {
               if (hour < 10) {
                  System.out.println("0" + hour + ":" + min + ":" + sec);
               }
            }
         }
         if (sec < 10) {
            if (min > 10) {
               if (hour > 10) {
                  System.out.println("0" + hour + ":" + min + ":" + sec);
               }
            }
         }
         if (sec > 10) {
            if (min < 10) {
               if (hour > 10) {
                  System.out.println("" + hour + ":0" + min + ":" + sec);
               }
            }
         }
         if (sec > 10) {
            if (min > 10) {
               if (hour > 10) {
                  System.out.println("" + hour + ":" + min + ":" + sec);
               }
            }
         }
         if (sec == 10) {
            if (min == 10) {
               if (hour == 10) {
                  System.out.println("" + hour + ":" + min + ":" + sec);
               }
            }
         }
         if (sec > 10) {
            if (min == 10) {
               if (hour == 10) {
                  System.out.println("" + hour + ":" + min + ":" + sec);
               }
            }
         }
         if (sec == 10) {
            if (min > 10) {
               if (hour == 10) {
                  System.out.println("" + hour + ":" + min + ":" + sec);
               }
            }
         }
         if (sec == 10) {
            if (min == 10) {
               if (hour > 10) {
                  System.out.println("" + hour + ":" + min + ":" + sec);
               }
            }
         }
         if (sec > 10) {
            if (min > 10) {
               if (hour == 10) {
                  System.out.println("" + hour + ":" + min + ":" + sec);
               }
            }
         }
         if (sec == 10) {
            if (min > 10) {
               if (hour > 10) {
                  System.out.println("" + hour + ":" + min + ":" + sec);
               }
            }
         }
         if (sec > 10) {
            if (min == 10) {
               if (hour > 10) {
                  System.out.println("" + hour + ":" + min + ":" + sec);
               }
            }
         }
         if (sec < 10) {
            if (min == 10) {
               if (hour == 10) {
                  System.out.println("" + hour + ":" + min + ":" + sec);
               }
            }
         }
         if (sec == 10) {
            if (min < 10) {
               if (hour == 10) {
                  System.out.println("" + hour + ":0" + min + ":" + sec);
               }
            }
         }
         if (sec == 10) {
            if (min == 10) {
               if (hour < 10) {
                  System.out.println("" + hour + ":" + min + ":" + sec);
               }
            }
         }
         if (sec < 10) {
            if (min < 10) {
               if (hour == 10) {
                  System.out.println("" + hour + ":0" + min + ":0" + sec);
               }
            }
         }
         if (sec == 10) {
            if (min < 10) {
               if (hour < 10) {
                  System.out.println("0" + hour + ":0" + min + ":" + sec);
               }
            }
         }
         if (sec < 10) {
            if (min == 10) {
               if (hour < 10) {
                  System.out.println("0" + hour + ":" + min + ":0" + sec);
               }
            }
         }
         if (sec == 10) {
            if (min < 10) {
               if (hour > 10) {
                  System.out.println("" + hour + ":0" + min + ":" + sec);
               }
            }
         }
         if (sec < 10) {
            if (min == 10) {
               if (hour > 10) {
                  System.out.println("" + hour + ":" + min + ":0" + sec);
               }
            }
         }
         if (sec > 10) {
            if (min == 10) {
               if (hour < 10) {
                  System.out.println("0" + hour + ":" + min + ":" + sec);
               }
            }
         }
         if (sec < 10) {
            if (min == 10) {
               if (hour < 10) {
                  System.out.println("0" + hour + ":" + min + ":0" + sec);
               }
            }
         }
         if (sec == 10) {
            if (min > 10) {
               if (hour < 10) {
                  System.out.println("0" + hour + ":" + min + ":" + sec);
               }
            }
         }
      }
   }
}

A:

First of all, your code is a mess.
You need to learn how to use conditions more effectively, also learn about formatting.
You can easily add '0' before any digit if it isn't a '2 digit number'.
System.out.println(String.format("%02d %02d %02d", hour, minute, second));

Your code doesn't work at ten o' clock because all of your conditions are 'hour > 10' or 'hour < 10', and both of those are false when hour == 10.

