K
K
Kvert0072014-04-08 10:27:02
Java
Kvert007, 2014-04-08 10:27:02

Should equals() be overridden?

Hello! In general, there is a code

public static void UsersCallProcedDell(String arg1,Statement arg2,String User,String Pass,String URLDB,String dir,Connection C) throws SQLException, FileNotFoundException, IOException,
                                                                     ClassNotFoundException {       
     String nameProcedure=ProcedureNameDel(arg1,arg2);
     String Role=NameRole(arg1,arg2);
     String query = "select NAME_USER from SOST_USERS where NAME_GROUP = '"+arg1+"' AND FLAG = 0";
     ResultSet rs1 = arg2.executeQuery(query);
     String s;
     String k;
     String pr=null;
     Integer hash1;
     Integer hash2;
      while(rs1.next())
      {
        s = rs1.getString(1);          
         query = "select NAME_GROUP from SOST_USERS where NAME_USER = '"+s+"' AND DSP = 1";
         ResultSet rs2 = arg2.executeQuery(query);
           while(rs2.next())
           {
             pr = rs2.getString(1);
               if (!pr.equals(arg1)) k="OK";
           }

The strings pr and arg1 are not compared even though they are both strings. Who will explain why?
If you look in the builder, then pr and arg1 are not the same.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question