Tuesday, 12 May 2020

Basic concept of Double Dimensional Array


Double Dimensional arrays is consists of two subscripts : one for the row and other for the column. 
The first subscript is always the row subscript and second is column subscript.   

class  Array2D
{
    public static void main(String args[])
    { 

        int[][] A = new int[2][3] ;
        A[0][1] = 11 ;
        A[0][1] = 22 ;
        A[0][2] = 33 ;
        A[1][0] = 44 ;
        A[1][1] = 55 ;
        A[1][2] = 66 ;           
        System.out.println(" The value is " + A[0][2]) ;
        System.out.println(" The value is " + A[1][1]) ;
    }
}                     
==========================================================

// Two Dimensional arrays is consists of two subscripts : one for the row and other for the column. 

class  DDA
{
    public static void main(String args[])
    {
        int[][] A = {{10,20,30} , {40,50,60}};         
        System.out.println(" The value is " + A[0][2]) ;
        System.out.println(" The value is " + A[1][1]) ;
    }
} 

======================================================

Subscribe my YouTube channel  :  SK Skill India 

=======================================================








2 comments: