Why does "yes or no?" get printed out twice before asking me for an input? (EasyReader is a thing that reads exactly what you type in)
public class CandyApp
{
public static void main (String args[])
{
int players;
boolean playgame = true;
String command;
EasyReader console = new EasyReader();
System.out.println("\nEnter Number of Players:");
players = console.readInt();
int player[] = new int[players];
for (int i = 0; i < players; i++)
{
System.out.println("\nHow many candies for player " + (i + 1) + "?");
player = console.readInt();
}
while (playgame == true)
{
System.out.println("yes or no?");
command = console.readLine();
if (command.equals("no"))
playgame = false;
}
}
}
public class CandyApp
{
public static void main (String args[])
{
int players;
boolean playgame = true;
String command;
EasyReader console = new EasyReader();
System.out.println("\nEnter Number of Players:");
players = console.readInt();
int player[] = new int[players];
for (int i = 0; i < players; i++)
{
System.out.println("\nHow many candies for player " + (i + 1) + "?");
player = console.readInt();
}
while (playgame == true)
{
System.out.println("yes or no?");
command = console.readLine();
if (command.equals("no"))
playgame = false;
}
}
}