Page 298 - Computer science 868 Class 12
P. 298
31 }
32
33 void display()
34 {
35 System.out.println("\nThe first array is");
36 for(int i=0;i<ar1_s;i++)
37 System.out.print(ar1[i]+"\t");
38 System.out.println("\nThe second array is");
39 for(int i=0;i<ar2_s;i++)
40 System.out.print(ar2[i]+"\t");
41 System.out.println("\nThe merged array is");
42 for(int i=0;i<ar3_s;i++)
43 System.out.print(ar3[i]+"\t");
44 }
45
46 public static void main()
47 {
48 merge_array ob = new merge_array();
49 ob.input();
50 ob.merge();
51 ob.display();
52 }
53 }
The output of the preceding program is as follows:
Enter the length of the first array
5
Enter the length of the second array
4
Enter the values for the first array
1 2 3 4 5
Enter the values for the second array
6 7 8 9
The first array is
1 2 3 4 5
The second array is
6 7 8 9
296296 Touchpad Computer Science-XII

