title: How could I fix this side effect?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java">How do I compare strings in Java?</a>  </p>
  </blockquote>
  
  
  
  <p>I am having a problem with the code below; the issue is that after you don't say map the first time, it keeps repeating <code>No try again</code> with the input box, no matter if you type "map" or not.    </p>
  
  <pre><code> System.out.println("My cousin Diego is in trouble in the Majestic palace. But how do we get there?");
   System.out.println("Who do we call when we don't know where to go?         Huh? I didn't get that...");
   imTheMap=robotMagic.next();
   if (imTheMap.equals("map"))
   {
      System.out.println("That's right!"); //the issue is here
   }
   else 
   {
      while(imTheMap!=("map"))
      {
          System.out.println("No! try again");
          imTheMap=robotMagic.next();
      }
   }
  </code></pre>