title: Checking empty string in Java
body: <p>I don't know what is wrong with the below code.... I am getting input from a textbox and putting the input in a string. If the textbox is empty it will return a empty string. In the below code</p>
  
  <pre><code>   String[] str = new String[9]; 
     for(int i=0;i&lt;9;i++){
         if(str[i].equals("")){
            System.out.println("set " + cmds[i] + " " + str[i]);
            WriteThread.sendCommand("set " + cmds[i] + " " + str[i] + "\n", false);
         }
      }
  </code></pre>
  
  <p>In the above code <code>str[i]</code> stores the input text of textboxes and I am trying to check if any element of the array is empty. I also tried with <code>str[i] == ""</code> and <code>str[i] == null</code> but no luck. The statement inside the if block if i am printing the string <code>str[i]</code>, it shows nothing that means it is empty. </p>
  
  <p>Am I doing anything the wrong way?</p>