if( a == 1 && b == 3 ) { System.out.println( "Comparison via &&" + "\na is " + a + "\nb is " + b ); }
At first it checks if a == 1 is true, so it should go on and check if b == 3 , it is not, therefore true && false is false and you will not get the output.
if you have
if( b == 3 && a == 1 ) { System.out.println( "Comparison via &&" + "\na is " + a + "\nb is " + b ); }
he will first check if b == 3 , and since it is not, don’t even look at a == 1 , because false && whatever always false , it doesn’t matter what.
Does this answer your question?
source share