Why the Boolean operation result false? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why the Boolean operation result false?

I use regex split method and use the result to match the word but the result always false even it's the same word https://code.sololearn.com/c2Ji7Fj4t9K5/?ref=app

1st Dec 2021, 12:14 PM
johannes lumbantoruan
johannes lumbantoruan - avatar
1 Answer
+ 1
To compare a string u should use String.equals(String) ; from your Code System.out.println(word[0].equals( "Java"));
1st Dec 2021, 12:59 PM
Pariket Thakur
Pariket Thakur - avatar