title: Java time displaying unexpected results?
body: <p>The following is code which takes the three numbers (hours, minutes, and seconds) given in myobject.settime, and display them formatted correctly in military time. The problem is, when I am giving three numbers, the output on my console has three entirely different numbers.</p>
  
  <pre><code>public class Clock{
      public static void main (String [] args){
          Time myobject = new Time();
          System.out.println(myobject.tomilitary());
          myobject.settime(13, 27, 6 );
          System.out.println(myobject.tomilitary());
      }
  }
  
  class Time{
      private int hour, minute, second;
  
      public void settime(int h, int m, int s){
          hour = ((h&gt;=0 &amp;&amp; h&lt;24) ? h : 0); //ternary operator, kind of like an if statement
          hour = ((m&gt;=0 &amp;&amp; m&lt;60) ? m : 0);
          hour = ((s&gt;=0 &amp;&amp; s&lt;60) ? s : 0);
          System.out.println(h +"\t" +m +"\t" +s +" \t The next line should display these three numbers");
      }
  
      public String tomilitary() {    
          return String.format("%02d:%02d:%02d", hour , minute , second ); //%02d means display two decimal places for each int after the quote.
      }                                                  
  }
  </code></pre>
  
  <p>Right now my output is:</p>
  
  <pre><code> 00:00:00
   13 27  6    The next line should display these three numbers
   06:00:00
  </code></pre>
  
  <p>But the last line of my output (06:00:00) should be (13:27:06) please explain what is going on. </p>