if(mail.equals(usermail) && date1.equals(date) && title1.equals(title))
            {
                System.out.println("record is matched");
                returnFlag = true;
                break;

         }

the if statement is not executing even though all the strings are equals.

Edited 3 Years Ago by Reverend Jim: Fixed formatting

If the "if statement is not executing", then either it is not being called or the values are not equal. Those are the only possibilites (considering the posted code).

Edited 6 Years Ago by masijade: typo

but the values are equal then, what may be the reason that if statement is not executing

Because you're not calling it? Because the execution block never reaches the if statement? (I am talking about the if statement, not the code block associated with.)

Right before you call the if statement, why don't you try printing out the value of each of those equals() method calls and tell us what it says.

System.out.println(mail.equals(usermail)); 
System.out.println(date1.equals(date)); 
System.out.println(title1.equals(title));

start quote:

         if(mail.equals(usermail) && date1.equals(date) && title1.equals(title))
            {
                System.out.println("record is matched");
                returnFlag = true;
                break;

         }

the if statement is not executing even though all the strings are equals.

As BestJewSinceJC, suggested you can try to print each of the values or you can add a logger to identify if control is entering the loop and displaying logger.info(""). Let us know if you are not familiar with this and we can help.

Cheers,
Adi

Edited 3 Years Ago by mike_2000_17: Fixed formatting

This article has been dead for over six months. Start a new discussion instead.