Question: Write a program that has a method called backwards that takes in a String. The method determines if the word is spelled the same forward
Write a program that has a method called backwards that takes in a String. The method determines if the word is spelled the same forward as backwards, such as kayak. It returns a boolean (true if it is spelled the same or false if it is not). The method should work for both capital and small letters (ie: Kayak would still return true). In the main method, use a Scanner object to read in a String. Call the method backwards and pass in the word. Then print to the screen, the word and the boolean (true/false) response.
The method header looks as follows:
public static boolean backwards (String phrase)
You must use a method.
Input
A single string.
Example Input: kayak
Output
The inputted string followed by a boolean
Example Output: kayak true
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
