Java – if there is a statement with \ u0026 \ u0026, the first condition needs to be true before testing the second
•
Java
See English answer > @ L_ 301_ 0 @ 9
From my test, it seems that the if statement will exit [10] before trying to go to the array Am I always like this? This means that if I have & & false on the left in my if statement, will I exit before testing the second one? In this regard, will it test the left first?
public static void main(String[] args) { boolean [] array = new boolean [10]; Arrays.fill(array,true); int i = 10; if(i < array.length && array[i]){ System.out.println("WhoHoo!"); } }
Solution
From the Java tutorials operator:
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码