title: Java - Why can't I use charAt() to see if a char equals another?
body: <p>I want to see if a character in my string equals a certain other char value but I do not know what the char in the string is so I have used this:</p>
  
  <pre><code>if ( fieldNames.charAt(4) == "f" )
  </code></pre>
  
  <p>But I get the error:</p>
  
  <pre><code>"Operator '==' cannot be applied to 'char', 'jav.lang.String'"
  </code></pre>
  
  <p>But <code>"g" == "h"</code> seems to work and I know you can use <code>'=='</code> with char types. </p>
  
  <p>Is there another way to do this correctly?
  Thanks!</p>