Friday, 15 May 2015

For-Loop and Arrays Java -


Can someone explain me words that actually have code for 'after'? I am confused by the mixture of int and booleans within 'for' (still a start), it is about checking whether there are equal values ​​in the same sequence of two arrays or not. Thanks in advance:

  public stable boolean par (int [] a1, int [] a2) {if (a1.length! = A2.length) {return false; } Bullion equal = true; For (int i = 0; i & lt; a1.length and similar; i ++) {equal & amp; = A1 [i] == A2 [i]; } Return equals; } There are 4 parts in the loop:  
   

Preliminary is the part where you start the variables that are in full swing.

Condition is Boolean expression, which is body .

has been evaluated for the right results in execution. / Decrease where you can change the value of any variable in the loop area.

After the keyword all 3 parts are optional, so you can create an infinite loop as shown:

  for (;;) {System.out .println ("body"); }  

No comments:

Post a Comment