subject

To help manage the wizarding world, we need to write a merge method. For the general purpose, let us write a generic merge method. Namely, given two arrays of T objects, for example, Hogwarts students, the merge method would use stacks to merge these two T objects in the way specified in the above mentioned description and return a new ArrayList with these T objects in a special order.

The generic method prototype is as follows:

public ArrayList merge(T[] wizards1, T[] wizards2) throws Exception;

To help reverse Hogwarts students' names, we can invoke the method as follows:

merge({2, 4, 1}, {5, 7, 3})

where {2, 4, 1}, {5, 7, 3} is two array inputs and it will return an java. util. ArrayList instance, containing {1, 3, 4, 2, 7, 5}

Please use Stacks to implement the generic reverse method:

public ArrayList merge(T[] wizards1, T[] wizards2) throws Exception;

Task 2. (12 points)

Please write a test block of code by calling the method and handling the possible exception, where a String array is declared and initialized, invoke the merge method that you define and implement in the task 1. Since the merge method could throw an exception instance, we also need to write a try-catch block in order to handle the exception.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 17:00
The more powerful, 60 volt cables and the main power shut-off on an hev are both colored orange.
Answers: 1
question
Computers and Technology, 24.06.2019 08:30
@josethesolis i need can anyone text me and follow me
Answers: 1
question
Computers and Technology, 24.06.2019 10:00
When writing a business letter, how many times can you use the same merge field in a document? once once, unless using the address block feature unlimited it will depend on the type of document you choose
Answers: 1
question
Computers and Technology, 24.06.2019 14:00
Text or graphics that print at the bottom of every page are called footings footers headers headings
Answers: 1
You know the right answer?
To help manage the wizarding world, we need to write a merge method. For the general purpose, let us...
Questions
question
Computers and Technology, 20.11.2020 22:10
question
Business, 20.11.2020 22:10
question
Mathematics, 20.11.2020 22:10
question
Mathematics, 20.11.2020 22:10
question
Mathematics, 20.11.2020 22:10
question
Chemistry, 20.11.2020 22:10
question
Biology, 20.11.2020 22:10
question
Health, 20.11.2020 22:10