title: Why doesn't my string comparison work?
body: <p>Ok, this is stupid, but wtf is going on?</p>
  
  <p>I have a String variable in a servlet, which takes the value of a parameter and based on that value I make a test to do something, but the <code>if</code> is not working. What is the problem?</p>
  
  <pre><code> String action = request.getParameter("action");
      System.out.println("Action: " + action);
  // I put 2 ifs to be sure, but not even one is working
      if(action.equals("something"))
              {
                  System.out.println("hey");            
              }
      if(action.trim() == "something")
              {
                  System.out.println("hey");
              }
  </code></pre>
  
  <p>On the console, the System.out.println shows me that the value of action is "something"</p>
  
  <pre><code>Action: something
  </code></pre>