Question: (JoinArrays) Write a method, joinArrays, which receives two ArrayList of Integer, and concatenates them (joins them together to make one, larger array). The method will

 (JoinArrays) Write a method, joinArrays, which receives two ArrayList of Integer,
and concatenates them (joins them together to make one, larger array). The
method will not alter the two original ArrayLists but will return a

(JoinArrays) Write a method, joinArrays, which receives two ArrayList of Integer, and concatenates them (joins them together to make one, larger array). The method will not alter the two original ArrayLists but will return a new ArrayList of Integer Example: X5 4 3 2 1 y 8 7 6 Z joinArrays (x,y) will return a new array as follows. 5 4 3 2 1 8 7 6 Sample Output: 2, 1 Original arrays: Array: 5, 4, 3, Array: 8, 7, 6 Result of join(x,y). Array: 5, 4, 3, 2. 1, 8, 7. 6 mport java.util.*; ublic class JoinArrays public static void main(String[] args) { ArrayList X = new ArrayList(); ArrayList y = new ArrayList(); ArrayList z; int i; for(i=5; i >0; i--) x.add(i); for( i=8; i >=6; i--) y.add(i); System.out.println("Original arrays:"); display(); display(y): z = joinArrays(x, y): System.out.println("Result of join(x,y)."): display(); } private static void display( ArrayList x) { System.out.println("Original arrays:"); display(); display(y): z = joinArrays(x, y): System.out.println("Result of join(x,y)."); display(z); } private static void display( ArrayList x) { int i; System.out.print("Array: "); for(i=0; i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!