हिंदी

Difference between Single Dimensional Array and Double Dimensional Array

Advertisements

Topics

CISCE: Class 10

Assigning Data in 2 D Array:

1. By using the Assignment Statement 

Note: In this method, the data values are defined within the program itself. They may be of any data type. For Example: int m[ ][ ] = { {1,2,3,4 },{5,6,7,8},{9,10,11,12} }; 

2. By Using BlueJ System 

Note: The data values are entered at the time of executing the program. For input of data, there are 2 nested for loops, one each for column and row.  

Syntax: public static void main(int m[][]) 

3. By Using lnputStreamReader Class  

Note: In this method also, the data are to be entered during execution of the program. They may be of any type. Syntax: int m[ ][ ] = new int[3][4]; 

4. By using Scanner Class 

Note: Import “java.util.*”, create “Scanner” object, then declare “int arr[][] = new int[5][3];” 

Advertisements
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×