Wednesday, 13 May 2020

Print all the String elements using DDA

Write a program to input and store String elements in a double dimensional array of size  3 x 4  and Print all the String elements.

import java.util.*;

class  DD
{
    public static void main(String arg[])
    {
        String[][]  nm = new String[3][4];
                 
        Scanner sk = new Scanner(System.in); 
    
        System.out.println("Enter the names  ");
        
        for(int i=0 ; i<3 ; i++)
        {
            for(int j=0 ; j<4 ; j++)
            {
                nm[i][j] = sk.nextLine();
            }
        }
        
        System.out.println("The output is : ") ; 
        
        for(int i=0 ; i<3 ; i++)
        {
            for(int j=0 ; j<4 ; j++)
            {
               System.out.print(nm[i][j] + "  ") ;  
            }
            System.out.println() ; 
        }          
    
    }
}

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

Subscribe and Share my Blog and YouTube channel 

Blog : www.definecompute.blogspot.com

YouTube  :  SK Skill India 

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





1 comment:

  1. Nice Blog…!! Thanks for sharing this article. If you want to be a best technician of Printer. Check out for Printer Repairing Institute In Delhi India .

    ReplyDelete