Logical Error in Java Program
<p>I have created two methods that take in a number and should count from that number to 0 and print it out. One method incorporates a while loop, which works fine. The other method uses a for loop. But for some reason, I'm not getting the expected output in the method that uses a for loop. How come?</p>

<pre><code> import java.util.*; 

 public class Methods 
 {
     public static void main(String[] args)
     {
         int n = 10;   
         countdown(n); 
         countdown2(n); 
     }

     public static int countdown(int num)
     {
         while(num &gt;= 0)
         {
             System.out.println(num); 
             num--;
         }
             return 0; 
     }

     public static int countdown2(int number)
     {
         for(int i = number; i &lt;= number; i--)
         {
             System.out.println(number);
             number--;
         }
             return 0;        
     }
 }
</code></pre>
