Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+20 votes

When using equalsIgnoreCase, do you write it as
(example) word.equalsIgnoreCase("b")=B;
or you write it as word.equalsIgnoreCase("b"); ?

asked in CSC211_Winter2018 by (8 points)

3 Answers

+14 votes

It would just be word.equalsIgnoreCase("b");

answered by (8 points)
+12 votes

Either way would be fine. The formula already ignores case.

answered by (8 points)
+11 votes

string.equalsIgnoreCase() returns a boolean value (usually used in conditional statements)
word.equalsIgnoreCase("b")=B is not valid at all. =B means assigning value of B to the left.
So only word.equalsIgnoreCase("b") is right.

answered by (8 points)
...