Question: Write a method that takes a String and swaps the first and last character of the String and returns it with the new String. The
Write a method that takes a String and swaps the first and last character of the String and returns it with the new String. The method works with two conditions: 1. It should return with a message "Invalid String" if the length of the string is less than three. 2. It should return with a message "It's a pair" if the first and the last characters are the same.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
