I thought that (x.equalsIgnoreCase(y)) assigns itself a value of true or false based on the variables you put into it, but I needed to do that manually? ((x.equalsIgnoreCase(y)) == true) ?
I'm confused about the (x.equalsIgnoreCase(y).
Under discussion
Comments (1)
- Popular
- New
- Old
You must be signed in to leave a comment
AlejandroExpert
17 December 2023, 12:48
Hi Matthew,
Yes, "x.equalsignoreCase(y)" should work as a true or false value.
But also, your "x.equalsignoreCase(y)== true" would work (because it is a fair comparison (boolean vs boolean).
On the other hand, you could also try with the following: " ( ___ ? ___ : ___) ".
Try something like: System.out.println( (x.equalsIgnoreCase(y) ) ? "Acces allowed" : "Acces denied");
+1