Question: 10. Reversing the elements of an array involves th exchanging the corresponding elements of e array: the first with the last, the second with the
10. Reversing the elements of an array involves th exchanging the corresponding elements of e array: the first with the last, the second with the next to the last, and so on, all the way to the middle of the array. For example, if the array has 4 elements: (80, 85, 95, 100), we want to reverse the elements so that the array becomes (100, 95, 85, 80). Given an array a, write a loop that reverses the elements of the array. You may declare additional variables as needed. (For full credit, invoke one of the swap methods from question 9 appropriately.) 11. Write a method that receives a String as a parameter, creates a new String that contains the same characters in the specified String but in reverse order, and returns that String. For example, if the String received as a parameter is "loop, the method should return "pool. Your method should work for any String. You will need to appropriately invoke the charAt method of the String class. Its description in the Java standard library is: char charAt (int index) Returns the char value at the specified index
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
