title: Why do I need to add an 'f' to value so my code outputs the right value?
body: <p>The following is my code that works ::</p>
  
  <pre><code>public class AvgSpeed{
      public static void main(String[] args){
          double kph, km, hours, seconds, minutes, time;
          km = (1.6 * 24);
          hours = 1;
          minutes = 2/3f;
          seconds = 35/3600f;
          time = hours + minutes + seconds;
          kph = km/time;
          System.out.println(kph);
      }
  }
  </code></pre>
  
  <p>If I remove the f's for minutes and seconds, it keeps printing out 38.4, which is not right. It should be some number close to 22.906</p>
  
  <p>I don't even know the reason why I need to add the f, I did it on a whim. I thought declaring the two variables as a double was enough?</p>