Question: Write a JAVA program with a method called fit Switch, which takes an array of Strings as an argument. This method should then return a

Write a JAVA program with a method called fit Switch, which takes an array of Strings as an argument. This method should then return a new array with every pair of elements from the original array swapped in position. If there is an odd number of elements, the last element should be left in its place. For example: // Input {"an", "even", "set", "test"); // Output {"even", "an", "test", "set"); // Input {"an", "odd", "set": //Output {"odd", "an", "set"}; Write a JAVA program with a method called fit Switch, which takes an array of Strings as an argument. This method should then return a new array with every pair of elements from the original array swapped in position. If there is an odd number of elements, the last element should be left in its place. For example: // Input {"an", "even", "set", "test"); // Output {"even", "an", "test", "set"); // Input {"an", "odd", "set": //Output {"odd", "an", "set"}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
