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

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!