错误:不是声明,我该如何解决?

时间:2014-02-23 10:45:07

标签: java if-statement error-handling

        System.out.Println("Do you want to continue ?");
            if 
                (choice.equalsIgnoreCase("yes")||choice.equalsIgnoreCase("y"))
                {
                    LinkedTeams.createList();       
                }

            else 
                (choice.equalsIgnoreCase("no")||choice.equalsIgnoreCase("n"))

错误发生在下面声明的其他部分,我现在想知道我做错了什么,因为我无法看到半冒号或常规麻烦的任何错误

{
                        MainMenu.MENU();
                    }       
            }while()    

        }

                public static void printList()
                            {

                                currentNode=headNode;

                                while (currentNode!=null)
                                    {
                                        System.out.println(currentNode.pokemonName);
                            Im unable to differentiate the difference between the two 

            System.out.println(currentNode.pokemonType);

                                        currentNode=currentNode.next;
                Just unable to find enough information                  }   
                            }






}

2 个答案:

答案 0 :(得分:2)

 System.out.Println("Do you want to continue ?");
            if 
                (choice.equalsIgnoreCase("yes")||choice.equalsIgnoreCase("y"))
                {
                    LinkedTeams.createList();       
                }

            else if 
                (choice.equalsIgnoreCase("no")||choice.equalsIgnoreCase("n"))

其他不接受陈述,因为它已经达到了一个部分。添加“if”应该解决。

答案 1 :(得分:1)

您的意思是else if而不只是elseif-then and if-then-else statements