## Lecture 2 (13:00) - Remember to use `string1.equals(string2)` rather than `string1 == string2`, as the former may not be accurate. ### For Loop Cont. #### Example 1: ```java int sum = 0; for( int i = 0; i < animalCount.length; i++ ) { sum += animalCount[i]; } ``` Loop Control: - Initialisation - Loop Condition - Update for the amount of times in the length of the animalCount array, add the animalCount\[i] to the sum. #### Example 2: ```java for( int k = 1; k < 500; k += 2) { System.out.println(k); } ``` #### Example 3: ```java for( int i = 1; i < 4; i++ ) { for( int j = i; j < 5; j++ ) { System.out.println( i * j + "\t" ); } } ``` i = 1, j = 1, 2, 3 ,4 | 1, 2, 3, 4 i = 2, j = 1, 2, 3, 4 | 2, 4, 6, 8 i = 3, j = 1, 2, 3, 4 | 3, 6, 9, 12 - \\t represents a TAB character.