Simple boolean in a do while loop that's not working..

Don't worry, I tried that before I posted this. It turns out that the main problem was the boolean. Don't know if it had to do with my code, but now matter what answer was entered, the boolean answer would not change. changing the || to && and removing lines 93-100 would have probably worked had I just put }while (answer != 'N'));

Anyways, I ended up doing trying a lot of other stuff while trying to fix the problem and ended up with this.

import java.util.Random; import java.util.Scanner;

import javax.swing.JOptionPane;

public class MainClass {

public static void main(String[] args)

{
    Random myRNG = new Random();
    Scanner myKeyboard = new Scanner(System.in);
    String doAgain;

    do {

        String myChoice = JOptionPane.showInputDialog(null, "Please enter S for scissors, R for rock, or P for paper: ").toUpperCase();


        if ((!(myChoice.equals("R"))) && (!(myChoice.equals("P"))) && (!(myChoice.equals("S")))) 
        {
            JOptionPane.showMessageDialog(null, "Error: Invalid choice.");          
        }
        else{

            int cpuChoice = myRNG.nextInt(3);
            if (myChoice.equals("R")) 
            {

                if (cpuChoice == 0) 
                {
                    JOptionPane.showMessageDialog(null, "We both picked rock!\nThe game is a draw.");

                } 
                else if (cpuChoice == 1) 
                {
                    JOptionPane.showMessageDialog(null, "You picked rock.\nI picked paper.\nYou lose!");

                } 
                else if (cpuChoice == 2) 
                {
                    JOptionPane.showMessageDialog(null, "You picked rock.\nI picked scissors.\nYou win!");
                }
            } 
            else if (myChoice.equals("P")) 
            {
                if (cpuChoice == 0) 
                {
                    JOptionPane.showMessageDialog(null, "You picked paper.\nI picked rock.\nYou win!");
                } 
                else if (cpuChoice == 1) 
                {
                    JOptionPane.showMessageDialog(null, "We both picked paper!\nThe game is a draw.");
                } 
                else if (cpuChoice == 2)
                {
                    JOptionPane.showMessageDialog(null, "You picked paper.\nI picked scissors.\nYou lose!");
                }
            } 
            else if (myChoice.equals("S")) 
            {
                if (cpuChoice == 0) 
                {
                    JOptionPane.showMessageDialog(null, "You picked scissors.\nI picked rock.\nYou lose!");
                } 
                else if (cpuChoice == 1) 
                {
                    JOptionPane.showMessageDialog(null, "You picked scissors.\nI picked paper.\nYou win!");
                } 
                else if (cpuChoice == 2) 
                {
                    JOptionPane.showMessageDialog(null, "We both picked scissors!\nThe game is a draw.");
                }
            }

        }

        doAgain = JOptionPane.showInputDialog("Do it again? (Y/N)").toUpperCase();
        while(!(doAgain.matches("[YN]+"))) 
        {               
            JOptionPane.showMessageDialog(null, "Error: Invalid choice.");
            doAgain = JOptionPane.showInputDialog("Do it again? (Y/N)").toUpperCase();

        }

    } while (!(doAgain.equals("N")));
    JOptionPane.showMessageDialog(null,"GoodBye!");
}

}

/r/javahelp Thread Parent