title: JAVA .equalsIgnoreCase not working
body: <p>In the main method of my server class I have a series of <code>if</code> statements for the reserved keywords of a chat program which I am trying traverse using the value of a variable along with the <code>.equalsIgnoreCase</code> method. The problem is that even though my variable holds a certain value, when executing the program the code always steps into the <code>else</code> clause even if there is an exact match between the variable and one of the <code>if</code> conditions. The code compiles fine but I just cant figure out why this is happening. I have printed the value of the variable just before commencing the <code>if</code> statements to verify it held the correct value. A snipet from my code is shown below:</p>
  
  <pre><code>System.out.println("Keyword is : " + keyword);
  if (keyword.equalsIgnoreCase("who")) 
  {  
    System.out.println("calling who function");
    whoFunction(address, socket, port);
  } 
  else if (keyword.equalsIgnoreCase("whoami")) 
  { 
    whoami(address, socket, port, clientAddress);
  } 
  else if (keyword.equalsIgnoreCase("all")) 
  {   
    all(message);
  } 
  else if (keyword.equalsIgnoreCase("Bye")) 
  {
    bye(address, socket, port, clientAddress);
  } 
  else 
  {     
    newUser(keyword, address, searchListLength, clientAddress, port);
  }
  </code></pre>
  
  <p>No matter what the value of the keyword is, it always resorts to selecting the final else statement. As you can see this will result in always call my <code>newUser</code> class. Am I missing something here? Probably staring me in the face :/</p>