Will anyone please help me i have an if clause and in it there is two conditional checking by means of or condition ,but its not working an i have given the code below
if ((!"C".equals(FKLoadStatus))||(!"D".equals(FKLoadStatus)))
{
confirm_Depot_button.setEnabled(true);
}
else
{
confirm_Depot_button.setEnabled(false);
}
Your expression is always evaluated as true.
If
FKLoadStatusequals to “D” then it’s not equal to “C”, so you getif(!fals || !true)which isif(true || false)which istrue. And vice versa.You probably (while it’snot clear from your answer) meant –
if ((!"C".equals(FKLoadStatus))&&(!"D".equals(FKLoadStatus)))