GitHub Viewer
/*
* ============================================================================
* Program Name : Jagged Array
* File Name : 076-Jagged-Array.java
* Class Name : JaggedArray
*
* Description:
* This program demonstrates the use of a Jagged Array (Array of Arrays)
* in Java. A jagged array allows each row to have a different number
* of columns.
*
* Objective:
* - Understand the concept of Jagged Arrays.
* - Learn how to create rows with different column sizes.
* - Learn how to read and display Jagged Array elements.
*
* Author : Shaik Mahaboob Basha
* Repository : 01-Core-Java
* Folder : 08-Java-Programs
* ============================================================================
*/
import java.util.Scanner;
public class JaggedArray {
// The main() method is the entry point of every Java application.
public static void main(String[] args) {
// Create a Scanner object to read input from the keyboard.
Scanner scanner = new Scanner(System.in);
// Ask the user to enter the number of rows.
System.out.print("Enter the Number of Rows: ");
// Read the number of rows.
int rows = scanner.nextInt();
// Check whether the entered number of rows is valid.
if (rows