Question: Write method public static Arraylisto ArrayList concatenate ( ArrayList a , ArrayList b ) that concatenate one array list after another. For example, ifais [

Write method public static Arraylisto ArrayList concatenate(ArrayList a, ArrayList b)
that concatenate one array list after another. For example, ifais [Dear, Mr.. Adam, Smith]
and b is [wish, you, happy New, Year] then concatenatel) returns the array list [Dear, Mr.r Adam, Smith,
wish, you, happy, New, Year]
The elements of the array list should be entered by the user.
Sample Input
Enter element:
Dear
Enter -1 to stop or else to continue
Enter element:
Mr.
Enter -1 to stop or else to continue
Enter element:
Davis
Enter -1 to stop or else to continue
-1
Enter element:
Happy
Enter -1 to stop or else to continue
2
Enter element:
New
Enter -1 to stop or else to continue
Enter element:
Year
Enter -1 to stop or else to continue
Sample Output
[Dear, Mr., Davis, Happy, New, Year]

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!