title: java - removing semi colon from a string if the string ends with it
body: <p>I have a requirement in which I need to remove the semicolon if it is present at the end of the String(only at the end). I have tried the following code. But still it is not getting replaced. Can anyone please tell what I need to change in the following code in the line number<br>
  (I referred the code from here <a href="https://stackoverflow.com/questions/1962181/how-do-i-delete-the-last-character-of-a-particular-string-in-java">How do I delete specific characters from a particular String in Java?</a>)</p>
  
  <pre><code>public static void main(String[] args) {
      String text = "wherabouts;";
      System.out.println("SSS "+text.substring(text.length()-1));
      if(text.substring(text.length()-1) == ";"){
          text.replaceAll(";", "");
      }
      System.out.println("TEXT : "+text);
  }
  </code></pre>