title: Why two same strings not matched under if condition....?
body: <p>Can you tell me where i have done mistake in this program
  .</p>
  
  <pre><code>import java.awt.*;
  import java.applet.*;
  import java.awt.event.*;
  /*&lt;Applet code="kk" height=400 width=400&gt;&lt;/applet&gt;*/
  public class kk extends Applet implements ActionListener
  {
      Button b;
      TextField t;
      String str1,str2;
      public void init()
      {
          b=new Button("submit");
          t=new TextField(20);
          add(t);
          add(b);
          b.addActionListener(this);
      }
      public void actionPerformed(ActionEvent ae)
      {
          try
          {
              str2="mohit";
              str1=t.getText();
              if(str1==str2)
              {
                  System.out.println("matched");
              }
              else
              {
                  System.out.println("not matched");
              }
          }
          catch(Exception e)
          {
              System.out.println("Exception caught ");
          }
      }
  }
  </code></pre>
  
  <p>Don't know why str1 and str2 are not matched.</p>