Hi
i have problem to use this method
even i type correct or wrong string is still loop
do {
menu();
empName = input.next();
} while (!(empName.trim().equalsIgnoreCase("E2001"))
|| !(empName.trim().equalsIgnoreCase("E277"))));
any suggestion to use not with comparing two string
thanks in advanced
Programming Languages-OtherJava
Last Comment
ang3lus
8/22/2022 - Mon
Mick Barry
should be && not ||
} while (!(empName.trim().equalsIgnoreCase("E2001"))
&& !(empName.trim().equalsIgnoreCase("E277"))));
Mick Barry
or
} while (!(empName.trim().equalsIgnoreCase("E2001")
|| empName.trim().equalsIgnoreCase("E277")));
ang3lus
ASKER
there problem is not with loop
even if use !equalingnorecase with if ==> if statement always not true
if(!(empName.trim().equalsIgnoreCase("E2001"))
syso("print something");
is there any alternative way to use ! with string
i use trim to omit any space in string, i used next() and nextLine()
same problem without any luck
} while (!(empName.trim().equalsIg
&& !(empName.trim().equalsIgn