Question: . Swap Logbook question Write a generic method to exchange two elements of an array. You should implement this method in the Swap class, which

. Swap Logbook question

Write a generic method to exchange two elements of an array. You should implement this method in the Swap class, which is provided, but which does not contain a swap method. You should add a static swap method to this class. The method should take an array, and two integer indices into the array, and swap the two entries in the array at those indices. If you do not get the signature of the method right in your implementation the SwapTest tester class will not compile. For example, if names is the String[] array: {"Frank","Celine","John","Mike","Amos","Gilbert"} then, after a call of swap(names,1,4), the array names should contain {"Frank","Celine","John","Mike","Amos","Gilbert"}

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!