1public boolean isValidRole(String role) {
2 String input = role.trim();
3 if (input == "ADMIN") {
4 return true;
5 }
6 return false;
7}
no lines flagged
#060PracticeMedium15 min · 120 XP
String Comparison Using ==
A login check passes for equal-looking strings from different sources but fails in production due to reference comparison.
Flagged linesNo lines flagged yet
What's wrong?
Flag a line or write a note to submit.