title: !string.equals(string) turns false result
body: <p>In a part of my program, I put a while loop to repeatedly ask for inputs. There is an option to type in the letter &quot;F&quot; and break the loop.
  This is my program:</p>
  <pre class="lang-java prettyprint-override"><code>public class Example {
      public static void main(String[] args) {
          int x = 0;
          ArrayList Numbers = new ArrayList();
          while (x==0) {
              System.out.println(&quot;Type your number:&quot;);
              Scanner s = new Scanner(System.in);
              if (s.equals(&quot;f&quot;) || s.equals(&quot;F&quot;)) {
                  x = 1;
              }
              else if (!s.equals(&quot;f&quot;) &amp;&amp; !s.equals(&quot;F&quot;)) {
                  int n = Integer.parseInt(s.next());
                  Numbers.add(n);
              }
          }   
      }
  }
  </code></pre>
  <p>When I run the program, I type some numbers and then type &quot;F&quot;. I see this error:</p>
  <pre><code>Exception in thread &quot;main&quot; java.lang.NumberFormatException: For input string: &quot;F&quot;
  at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:68)
  at java.base/java.lang.Integer.parseInt(Integer.java:652)
  at java.base/java.lang.Integer.parseInt(Integer.java:770)
  at Example.main(Example.java:13)
  </code></pre>
  <p>I believe the String &quot;F&quot; can pass through my <em>else if</em> but I don't know why. How can I solve this?</p>