Author | Message |
---|---|
RandomAccess
Posts: 101
|
Posted 00:51 Sep 25, 2018 |
I just discovered that, for some reason, the Strings I scan from the document twl06.txt give incorrect boolean values when compare to Strings created directly in the program, even though they print out the same. For example if I were to type out System.out.println(dictionary.get(0)); it would print out the string "aa" just fine as expected but System.out.println(dictionary.get(0) == "aa"); prints out "false". I've even tried comparing it to a list created in the code calling that value, and no matter what I do, it always comes out false. Is there a common mistake anyone suspects I'm making? I've never run into this problem before even though I've scanned documents many times before and would really like to know what's wrong. |
kknaur
Posts: 540
|
Posted 06:55 Sep 25, 2018 |
Review how to compare Strings, == does not work with Strings reliably. |
RandomAccess
Posts: 101
|
Posted 13:57 Sep 25, 2018 |
God I swear my greatest enemy in programming is my memory towards alternate means. |