回文不会正确输出

Palindrome won't output correcly

当我编译程序时在线程中出现错误异常"main"

我不知道为什么。我正在尝试创建一个程序,允许用户输入一个单词,然后输出该单词是否为回文

import java.util.*;

public class Palindrome{

    public static void main( String[] args ){
        String word=getWord();
       boolean w=isPalindrome(word);
       if(w==true)
           System.out.println(word + " is a palindrome");
       else
           System.out.println(word + " is not a palindrome");
    }

    public static String getWord(){
        Scanner keyboard = new Scanner( System.in ); 
        String word;                                                                               
        System.out.print("Enter a word: ");
        word=keyboard.nextLine();
        return word;
    }

   public static boolean isPalindrome(String word){
       int y=word.length();
       for (int i = 0; i < y; i++) {
          if (word.charAt(i) != word.charAt(y-i)
             return false;
        }
        return true;
   }
}

if 语句,大概在那一行,缺少右括号

if (word.charAt(i) != word.charAt(y-i) 行显然缺少右圆括号。

if (word.charAt(i) != word.charAt(y-i)) 正确。