title: Java if else statement changing string
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 have the following code but for some reason it won't change the string</p>
  
  <p>The accountClass returns the string "L"</p>
  
  <pre><code>String accountClass = accClass.substring(4, 5);
          if (accountClass == "A") {
              accountClass = "Staff - A";
          } else if (accountClass == "B") {
              accountClass = "Student - B";
          } else if (accountClass == "H") {
              accountClass = "Personal - H";
          } else if (accountClass == "K") {
              accountClass = "60 Plus - K";
          } else if (accountClass == "L") {
              accountClass = "Business - L";
          } else if (accountClass == "P") {
              accountClass = "Charity - P";
          } else if (accountClass == "Q") {
              accountClass = "AIB Subsidiary - Q";
          } else if (accountClass == "X") {
              accountClass = "Irish State Spons &amp; Sub's - X";
          } else if (accountClass == "Y") {
              accountClass = "Other Companies &amp; Orgs - Y";
          } else if (accountClass == "Z") {
              accountClass = "Impersonal &amp; Gen. Ledger - Z";
          }
  </code></pre>
  
  <p>I'm just wondering if its the == causing the problem or something else?</p>