I need to use equalsIgnoreCase to see if a string value matches the word "Yes" or not.
and I'm also asked about which one of the following ways I would choose, and why.
str = obj.getValue();
1) "Yes".equalsIgnoreCase(str);
2) str.equalsIgnoreCase("Yes");
I know that they both work the same way; that is, they provide same results and both ways are frequently used. But I can't seem to find which one is a better one to use, after I've looked at the implementation of equalsIgnoreCase(String str) in String.java.
Could someone please explain this to me?
Thanks!