Question: Suppose you are given a class Grammar containing a method public static boolean is Palindrome (String s) that returns true if the given string
Suppose you are given a class Grammar containing a method public static boolean is Palindrome (String s) that returns true if the given string is a palindrome (same forwards and backwards). Write a static method that, given the name of a text file, reads the file and returns an ArrayList containing all words in the file that are palindromes. The format of the file is words separated by single spaces. For example, the file containing: "we will kayak at noon madam" should return the list ["kayak", "noon", "madam"]. Do not write the isPalindrome method, just assume the class Grammar is available for you to use. You will not receive full point for implementing your own version of isPalindrome. Don't worry about imports. public static ArrayList readPalidromes (String fileName) (
Step by Step Solution
3.55 Rating (165 Votes )
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
