title: Comparing the value of readline() to a string
body: <p>I am reading the <code>inputstream</code> using <code>readline()</code> method and then trying to compare it.</p>
  
  <p>The code is as follows:</p>
  
  <pre><code>//socket is defined before this
  InputStream is = socket.getInputStream();
  
  br = new BufferedReader(new InputStreamReader(is));
  
  Line = br.readLine();
  
      if (Line  == "hey") {
          Log.d("watsapp client tag", "message pushed !!");
          Log.d("watsapp client tag", "" + Line);
  
  
      }
     else {
  
          Log.d("watsapp client tag", "message not pushed");
          Log.d("watsapp client tag", "" + Line);
  
      }
  </code></pre>
  
  <p>The above code always executes the else part. although first value of the input stream is "hey" and second is not. So I am expecting in the logcat "message pushed !!" and "message not pushed" instead I get both "message not pushed"</p>
  
  <pre><code>05-31 14:46:14.309    6138-6151/? D/watsapp client tag﹕ message not pushed
  05-31 14:46:14.309    6138-6151/? D/watsapp client tag﹕ hey
  05-31 14:46:14.339    6138-6151/? D/watsapp client tag﹕ message not pushed
  05-31 14:46:14.339    6138-6151/? D/watsapp client tag﹕ &lt;Messageadded:1112/&gt;
  </code></pre>
  
  <p>Please can tell what is going wrong at line <code>if (Line  == "hey")</code>. Thanks!</p>