title: Java - program isn't updating system.currentTimeMillis()
body: <pre><code>public class Clock {
      int second;
      int minute;
      int hour;
      boolean checkTime = true;
      float startTime, endTime, difference;
      public void time(){
          if(checkTime){
              startTime=System.currentTimeMillis();
              checkTime=false;
          }
          endTime=System.currentTimeMillis(); // THIS ISN'T UPDATING, keeps the same                       
                  //value as start value each run through.
          difference=endTime-startTime;
  
          if(difference &gt;= 1000){
              second++;
              checkTime = true;
          }
      }
      public int getSecond(){
          return second;
      }
      public int getMinute(){
          return minute;
      }
      public int getHour(){
          return hour;
      }
      public int getMs() {
          return (int)difference;
      }
  }
  </code></pre>
  
  <p>This is my clock class that I'm trying to create in order to keep track of time. I have a main class that is in an endless loop that continuously calls time();. The void method time should update the time each run and it refuses to update the endTime. The startTime will get an initial value, and then that same value will be given to endTime over and over again. Can someone explain as to why this is happening? *difference represents milliseconds</p>