Java: Using scanner to read in boolean values failing.
<pre><code>import java.util.Scanner;

public class Cardhelp2{

private static String[] pairArray={"A,A","K,K","Q,Q","J,J","10,10","9,9","8,8","7,7","6,6","5,5","4,4","3,3","2,2"};

public static void generateRandom(int k){
 int minimum = 0;
 int maximum = 13;
 for(int i = 1; i &lt;= k; i++)
   {
     int randomNum = minimum + (int)(Math.random()* maximum);
     System.out.print("Player " + i +" , You have been dealt a pair of: ");
     System.out.println(pairArray[randomNum]);
   }
} //reads array and randomizes cards

 public static void main(String[] args) {
 Scanner scan = new Scanner(System.in);
 System.out.print("How many players would you like to play with? ");
 int m = scan.nextInt();
 generateRandom(m);

//displays the cards

___________________________________________________
System.out.println("Would you like to play?");
 Scanner scanner = new Scanner(System.in);

 if(scanner.next().equalsIgnoreCase("y")||scanner.next().equalsIgnoreCase("yes")) {
System.out.println("This will be fun");
} else if(scanner.next().equalsIgnoreCase("n")||scanner.next().equalsIgnoreCase("no")) {
System.out.println("Maybe next time");
} else { 
System.out.println("Invalid character");

 }
 }
}
</code></pre>

<p>Im having trouble understanding why the end part is not working, I've been told i need to change scanner.next(); to a variable but im not sure how to do it and get the code working. Is there a simple way of reading in the users answer then displaying a response to the user?</p>

<p>Thanks</p>
