JAVA if statement problems
<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 an if statement in java to determine weather the person is a male or female by asking weather he is a boy or a girl. This is quite a stupid statement but my query is no matter what i input i always get "you are a female!" which is quite annoying. Could you please help? This is the code</p>

<pre><code>import java.util.Scanner;

class ifstatement {

    public static void main( String args[] ) {
        System.out.print( "please enter boy or girl as an input:" );

        Scanner x = new Scanner( System.in );
        String a = x.nextLine();

        if ( a == "boy" ) {
            System.out.print( "You are a male" );
        }
        else {
            System.out.print( "You are a female!" );
        }
     }
 }    
</code></pre>
