Arrays

💡 Arrays are not data types; they are data structures.

Example: Declaring an array capable of holding 8 characters of type 'char’

public class Main {
public static void main(String[] args) {
     char[] str = { 's', 'o', 'f', 't', 'w', 'a', 'r', 'e' };
      System.out.println(str); // software
}
}

Loops

While Loop

int i = 0; // Helper variable declaration
while(i < 10) { // Condition in parentheses
i++; // Update helper variable
}

Example: Infinite while loop

while(true){
// Infinite loop
}

for Loop

Example: Loop to iterate over each character in an array