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

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

下面的语句的else部分发生错误,林现在想知道我做错了什么,因为我看不到半冒号或任何错误经常麻烦错误:不是一个声明,我该如何解决这个问题?

{ 
         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     } 
          } 






} 
+0

在开始编码之前,您需要了解一种语言的基础。 http://docs.oracle.com/javase/tutorial/java/nutsandbolts/if.html – AJJ

回答

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")) 

否则不会采取声明,因为它已经是达成的部分。添加一个“如果”应该解决。