1

This is the section that doesn't loop

import javax.swing.JOptionPane; // needed to use dialog boxs

public class PalindromeDetector
{// begin class
         
       public static void main(String[] args)
       {//begin main
          String userWord, continueLoop = " ";
          int numString;
           
          JOptionPane.showMessageDialog(null, "This program will ask the user for a string and check to see if it is a palindrome.");
                   
          do
          {//begin do while loop
             userWord = JOptionPane.showInputDialog("enter a string.");
             
             if(PalORNot(userWord))
                JOptionPane.showMessageDialog(null, userWord + " is a palinedrome.");
             else
                JOptionPane.showMessageDialog(null, userWord + " is not a palinedrome.");
                
             continueLoop = JOptionPane.showInputDialog("Would like to try again? enter yes to try again or quit to exit.");
                                                     
          } while (continueLoop == "Yes" || coninueLoop == "yes"); //end do while loop
TheChubbyPanda
  • 1,721
  • 2
  • 16
  • 37
FreezeRuiz
  • 11
  • 1

1 Answers1

2

In Java continueLoop == "Yes" does not work, you have to use continueLoop.equals("yes") to compare strings.

And you forgot the t in second continueLoop by the way.

== compares whether it's the same object

.equals() compares whether it's the same value

Shraft
  • 332
  • 1
  • 5