Im trying to make a conditional statement in my java GUI program. I was already able to make connection with my database db2 and also able to execute query to obtain a result set.
The problem is that when i use a table data to compare with a string in a conditional statement (if), It always returns false and goes to else clause even though the data from the resultset is identical to the string im comparing it to.
I have written the code below.
String query3 ="select * from module where uname='ADMIN' and modulename='SETADMIN'";
                PreparedStatement pst2 = conn.prepareStatement(query3);
                ResultSet rs2=pst2.executeQuery();
                rs2.next();
                if (rs2.getString(1)=="ADMIN"){
                    JOptionPane.showMessageDialog(null, "if statement working");
                }
                else{
                    JOptionPane.showMessageDialog(null, "if statement not working");
                }
the resultset that will be obtained by the query would look like this
**UNAME   MODULENAME    CANADD   CANEDIT   CANDELETE**
  ADMIN     SETADMIN       T        T           T
everything else in the program seems fine except for the if clause always returning false and going straight to else clause
Any help would be much appreciated :)
 
     
     
     
    