When an if statement contains two (or more) conditions, and the first one fails, does the if statement check the second condition or continue on in the code?
Here are two examples:
int x = 1, y = 2;
if(x == 0 && y == 2)
System.out.println("Nothing");
if(x == 1 || y == 0)
System.out.println("Something");
In the first if statement, the conditions should return false, but is y == 2
even tested? And in the second example, the conditions should return true, but is y == 0
tested at all? Or in both cases, after the first condition, the code skips the second condition and continues on in the code?
Thanks in advance.