title: Error in leap year program, test case failure
body: <p>I'm a beginner in JAVA &amp; I've got this school problem </p>
  
  <hr>
  
  <p><code>: Given a year, check if the year is leap year or not. If yes, the output should be “Leap Year”.  Else output should be “Not a Leap Year”.  The input should be a positive four-digit number.  Else,  the output should be “Invalid Year”.</code></p>
  
  <p>I can't find the reason for the failed test case described below-</p>
  
  <hr>
  
  <p>Code:</p>
  
  <pre><code>if(year&gt;999)
             {
               if(year%4==0)  
                    {
                      if(year%100==0)
                        {
                            if(year%400==0)
                            System.out.print("Leap Year");
                            else
                            System.out.println("Not a Leap Year");
                        }      
                       else
                       System.out.println("Leap Year");
                     } 
                   else
                   System.out.println("Not a Leap Year"); 
              }
              else
              System.out.print("Invalid Year");
  
  </code></pre>
  
  <hr>
  
  <pre><code>12 tests run/11 tests passed     
  Error:
  Failed tests
  Test 1: Check the logic for leap year-1
  </code></pre>
  
  <hr>
  
  <p>For negative input, the output is "Invalid Year" even then the test case fails.</p>