What does java equals() return : <p>I have this code:</p>

<pre><code>if(!((s.substring(s.length() - 1)).equals(";"))){
    s = s + ";";
}
</code></pre>

<p>This code should be checking if the last character of a string is ";" and should add a semicolon to it if it is not the case, only it's doing the exact opposite, it adds a semicolon if the string already ends with one. My code works if I take out the exclamation mark. How is that possible, I read the documentation and .equals() should return true if the two expressions are equal. Am I missing something? Thanks</p>
