I have following code:
class Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
CharSequence cs = "5.00";
double danswer = 5.0000;
DecimalFormat df = new DecimalFormat("#.00");
if(cs.toString() == String.valueOf(df.format(danswer)))
{
System.out.println("person");
}
else
{
System.out.println("False");
}
}
}
Why am i not able to compare in this case? As both are string values? How can i compare the values in this case?