Why the logical operand == could not work properly when comparing data inputted from terminal with directly defined strings. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why the logical operand == could not work properly when comparing data inputted from terminal with directly defined strings.

28th Mar 2019, 1:23 PM
Mustafa Alzahlan
2 Answers
+ 3
Compare two strings: String input; String word; use equals method: input.equals(word) --> returns true if they are the same, false if not You can look here for difference between == and equals(): https://stackoverflow.com/questions/7520432/what-is-the-difference-between-and-equals-in-java
28th Mar 2019, 11:37 PM
Denise Roßberg
Denise Roßberg - avatar
+ 2
://Mustafa Walid Ali Alzahlan please attach your source code so community can help you
28th Mar 2019, 6:24 PM
Sudarshan Rai
Sudarshan Rai - avatar