title: How to compare two strings, and output the first if they're not equal
body: <p>I have the following problem... I need to compare two string and output the first one if they are not equal. Something like the code below, but printing the first string instead. How can I do it?</p>
  
  <pre><code>String myString1 = new String("abc123");
  String myString2 = new String("abc");
  if(myString1.equals(myString2))
  {
      System.out.println("The two strings are equal");
  }
  else 
  {
      System.out.println("The two strings are not equal");
  }
  </code></pre>