mardi 6 décembre 2016

Syntax placing, else statements?

So I've created a method which looks to me fine but apparently I've placed the else statement in the wrong place although it looks like it is where it should be. Here's the method:

  public ArrayList<FlashCard> getFlashCard() {

    ArrayList<FlashCard> listcards = new ArrayList<FlashCard>();
    if(this.readyToUse() == true)  {
    System.out.println("You may begin the quiz");
    for(int i = 0 ; i <=9 ; i++)  {
        String lineName = this.getLine();
        listcards.add(new FlashCard(lineName.split(":")[0], lineName.split(":")[1]));
    }
    else (
            System.out.println("h")
    )
} 
    return listcards;
}

What have I done wrong here and where should the else statement be? Any help is appreciated, thanks.

Aucun commentaire:

Enregistrer un commentaire