Java conditional statement
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/767372/java-string-equals-versus">Java String.equals versus ==</a>  </p>
</blockquote>



<p>I am using jcreator to practice java language. I came up with a conditional statement in which if the user input is = "test" it will print an "okay!" message. This is my code: </p>

<pre><code>class conditional {

    public static void main (String[] args) {

        Scanner user_input = new Scanner(System.in);

        String username;
        System.out.print("username: ");
        username = user_input.next();
            if (username == "test") {
                System.out.println("okay");
                    }
                    else {
                                    System.out.println("not okay");
    }
}
</code></pre>

<p>The above code does not show any error, it does not display the "okay" &amp;&amp; "not okay" message either. I am not sure what's wrong with my logic.</p>
