title: How to compare two strings of array in java?
body: <p>The if statement does not read the string in the array - tokens[i] so the condition after if does not execute. The string "hot" can not be read. Why is that so? Please help! Thanks.</p>
  
  <pre><code>public static void main(String[] args){
  
      String str = "Wow! It's getting realy hot in here." ;
      String delims = "[ .,?!/&gt;&lt;;:'_!`~/$/@/#/%/&amp;/|/[/]/{/}/)/(]+";
      String[] tokens = str.split(delims);
  
      for (int i = 0; i &lt; tokens.length; i++){
          if (tokens[i] == "hot"){
  
              System.out.println("Found!");
              break;
          } 
          else {
              System.out.println("Not found!");
          }
     }     
  
  } 
  </code></pre>