Problem Using Relational Operators !!

The code given under is not working corretly. The problem is stated as comments in the program.

if(result.next())

{

String temp_no=t_no.getText();

String temp_nm=t_name.getText();

String temp_result1= result.getString(2);

String temp_result2= result.getString(3);

if(temp_no!=temp_result1)// The condition is always true.Even if i give the same no & name as in database!! Why is it so?

{

JOptionPane.showMessageDialog(cdFrame,new String("There Is No Disc With The Specified Number !!"));

}

else

if(temp_nm!=temp_result2)

{

JOptionPane.showMessageDialog(cdFrame,new String("There Is No Disc With The Specified Name !!"));

}

else

{

upd.executeUpdate();

JOptionPane.showMessageDialog(cdFrame,new String("DATA HAS BEEN UPDATED !!"));

}

}

else

{

JOptionPane.showMessageDialog(cdFrame,new String("There Is No Such Disc As Stated In Old Data !!"));

}

The Program compiles properly and gives no runtime error. What's the problem!!

[1816 byte] By [sukrit_mehraa] at [2007-10-2 21:45:26]
# 1
yes dude, u can't use relational operators for objects.. its works only on simple data types..
Independent_Guya at 2007-7-14 1:00:59 > top of Java-index,Java Essentials,New To Java...