Consider a String variable pri with value 07:45:32PM , now in order to obtain the PM alone I applied,
pri = pri.replaceAll("[^A-Z]","");
So far things work fine, but trying to compare the value in the variable does not work, ie :
   if(pri=="PM")
   {
        hh+=12;
   }
The body of the loop does not get executed. My question is are the two values different, ie Pri=="PM" , Why is it so? And how do I get to check my if loop in a precise way? Thank you
EDIT1
So I tried if(pri.equals("PM")) instead of if(pri=="PM") , but still it did not solve the problem!
 
     
     
     
    