xxxxxxxxxx
//this way u can print your array row by row
for (int i = 0; i < row; i++){
for (int j = 0; j < column; j++){
System.out.println(array[i][j]);
}
}
//this way u can print your array column by column
for (int i = 0; i < column; i++){
for (int j = 0; j < row; j++){
System.out.println(array[i][j]);
}
}
xxxxxxxxxx
//this way u can print your array row by row
for (int i = 0; i < row; i++){
for (int j = 0; j < column; j++){
System.out.println(array[i][j]);
}
}
//this way u can print your array column by column
for (int i = 0; i < column; i++){
for (int j = 0; j < row; j++){
System.out.println(array[i][j]);
}
}
xxxxxxxxxx
// Initializing an array during declaration
int[] numbers = {10, 20, 30, 40, 50};
xxxxxxxxxx
// Declaring and initializing an array of integers
int[] numbers = new int[5]; // Creates an array of size 5
// Assigning values to array elements
numbers[0] = 10;
numbers[1] = 20;
numbers[2] = 30;
numbers[3] = 40;
numbers[4] = 50;
// Accessing array elements
System.out.println(numbers[0]); // Output: 10
System.out.println(numbers[2]); // Output: 30
System.out.println(numbers[4]); // Output: 50