
need help wrting this
Write a program that has an array of 5 Strings, and determines which ones are palindromes (letter-case does not matter).
thanks...

import java.util.*;
class CheckPalindrome
{
public static void main(String[] args)
{
String []array={"madam","moon","bob","hannah","sun"};
String []revarray=new String[array.length];
for(int i=0;i<array.length;i++){
String reverse = new StringBuffer(array[i]).reverse().toString();
revarray[i]=reverse;
}
ArrayList<String> list=new ArrayList<String>();
for(int i=0;i<array.length;i++){
if(array[i].equalsIgnoreCase(revarray[i]))
{
list.add(array[i]);
}
}
System.out.println("Palindrome Array Elements: ");
for(int i=0;i<list.size();i++){
System.out.println(list.get(i).toString());
}
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.