I am trying to write a program in Java that compares to times and displays them in order. Everything works, except for the fact that if someone entered for example a 10 for the hour, and a 9 for the minute, it prints as "10:9".
I would like for each single digit to have a 0 in front of it when it prints. The h variable stands for hour and the m variable stands for minute
System.out.printf("First time: %02d" , h1 , ":%02d" , m1 , "\nSecond time: %02d" , h2 , ":%02d" , m2);