Page 354 - ComputerScience_Class_11
P. 354
22 for (i=0; i<5; i++)
23 {
24 ar3[i]=ar1[i];
25 }
26 j=5;
27 for (i=0; i<5; i++)
28 {
29
ar3[j++]=ar2[i];
30 }
31 //Displaying the 3rd array
32 System.out.print("Merged Array is: ");
33 for (i=0; i<10; i++)
34 {
35 System.out.print(ar3[i]+ " : " );
36 }
37 }
38 }
The output of the preceding program is as follows:
BlueJ: Terminal Window - Java
Options
Enter element in 1st array: 23
Enter element in 1st array: 36
Enter element in 1st array: 31
Enter element in 1st array: 0
Enter element in 1st array: 2
Enter element in 2nd array: 25
Enter element in 2nd array: 36
Enter element in 2nd array: 32
Enter element in 2nd array: 31
Enter element in 2nd array: 25
Merged Array is: 23 : 36 : 31 : 0 : 2 : 25 : 36 : 32 : 31 : 25 :
11.8 DOUBLE-DIMENSIONAL ARRAY
A double-dimensional array or 2D array is a type of array which is used when we need to refer to data, stored in a
tabular form. In this tabular format, data are stored in horizontal and vertical form and are known as rows and columns
respectively.
352 Touchpad Computer Science (Ver. 3.0)-XI

