0

Someone knows how I check a word in an if-statement?

I'm trying to get user input and check in an if-statement. My input is a string (a) and it must have 'yes' stored. I tried 'if (a.next() == "yes") {' but it always goes directly to the 'else' part. (the code of the scanner is 'Scanner a = new Scanner(System.in);' . Can somebody help me?

21st Apr 2018, 8:56 AM
Kobe Smeyers
Kobe Smeyers - avatar
5 ответов
+ 3
Donna i think they are asking if the whole string includes ‘yes’...
21st Apr 2018, 9:39 AM
syul
syul - avatar
+ 2
Can you show us your code?
21st Apr 2018, 9:35 AM
syul
syul - avatar
0
thank you guys for helping. It worked verry well ;)
21st Apr 2018, 3:05 PM
Kobe Smeyers
Kobe Smeyers - avatar