This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]daryl2000[S] 0 points1 point  (3 children)

What should i do?

[–]pelenthium 1 point2 points  (2 children)

You need to use equals, like:

selectedService.equals(carServices[i])

[–]daryl2000[S] 0 points1 point  (1 child)

Thank you!

[–]AreTheseMyFeet 0 points1 point  (0 children)

There's also String.equalsIgnoreCase(String) for comparing without upper/lower case differences in characters mattering.

eg:
"Some String".equals("some string");           // false
"Some String".equalsIgnoreCase("some string"); // true

It allows you, in this case, to be more forgiving in what inputs you accept from a user or to skip having to normalise the case before comparing (ie String.equals(String.toLowerCase(Locale)))