2014-02-23 25 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")) 

否則不會採取聲明,因爲它已經是達成的部分。添加一個「如果」應該解決。