Leap year calculation using logical operators
<p>Can somebody explain the condition of the if statement?
I know what <code>&amp;&amp;</code> and <code>||</code> does, but now I don't understand how it calculates it correctly. I got it right by fluke, and I just want to understand why it does what it does.</p>

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

public class LeapYear {

    public static void main(String[] args) {
        Scanner lukija = new Scanner(System.in);

        System.out.print("Give year: ");
        int year = Integer.parseInt(lukija.nextLine());
        if (year % 4 == 0 &amp;&amp; ( year % 100 != 0 || year % 400 == 0 ) ) { 
            System.out.println("Year is leap year");
        } else {
            System.out.println("Year is not a leap year..");
        }
    }
}
</code></pre>
