// The "PalinDrome" class.
import java.awt.*;
import hsa.Console;
public class PalinDrome
{
static Console c; // The output console
public static void main (String[] args)
{
c = new Console();
c.println("Please enter a word");
String word = c.readLine();
int i;
int num = word.length();
String str = "";
for (i = num - 1 ; i >= 0 ; i--)
str = str + word.charAt (i);
if (str.equals (word))
c.println (word + " is a palindrome");
else
c.println (word + " is not a palindrome");
// Place your program here. 'c' is the output console
} // main method
} // PalinDrome class
我爲我的考試項目創建了迴文項目。該程序適用於諸如「媽媽」等較低字母的字母,但在有大寫字母例如「媽媽」時不起作用。你對我能做什麼有什麼建議嗎?如何使大寫字母的程序工作
String的javadocs包含您正在查找的內容。 –
'str.equalsIgnoreCase(word)' – Habib
好的,這個作品謝謝大家 –