Jagged Array

public class RotaionArray {

    public static void main(String[] args) {

        int A[][];//A is reference

        A =new int[3][];//A will create 3 colume which will act as a reference of every row elemnent

        A[0]=new int[2];//1st colum reference 2 element

        A[1]=new int[4];

        A[2]=new int[5];//A[2] 3rd colum reference which has 5 element 

        for(int x:A[2]){

            System.out.print(x);//x is the array element of A[2] row

        }

    }

    

}

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top