
Think of an array like apartment building with numbered units:

// Real-world example: Student grades
int[] studentGrades = new int[5]; // Building with 5 apartments
// [0] [1] [2] [3] [4] ← Index numbers (addresses)
// [ 0][ 0][ 0][ 0][ 0] ← Default values

// 🎬 Movie Theater Example
// Method 1: Declare then initialize
String[] movieTitles; // Just declare the variable
movieTitles = new String[3]; // Create array of size 3
// Method 2: Declare and initialize together
String[] topMovies = {"Inception", "Avatar", "Titanic"};
// Method 3: Anonymous array (useful for method parameters)
String[] newReleases = new String[]{"Spider-Man", "Batman", "Superman"};
// 🎮 Gaming Score Example - Multidimensional Arrays
int[][] gameScores = {
{100, 200, 150}, // Player 1 scores (3 levels)
{180, 220, 190}, // Player 2 scores
{95, 175, 200} // Player 3 scores
};
<aside> 💡
Real-World Analogy: Think of a 2D array like a spreadsheet:
gameScores[1][2] = Player 2's score in Level 3 = 190
</aside>