#if statement troubles

8 messages · Page 1 of 1 (latest)

knotty marlin
#

This program is supposed to detect if the string contains a hyphen(-). If it does it prints “this message contains a hyphen”. If it doesn’t it prints “this message does not contain a hyphen”. Here is a picture of my code

pine parrot
#

Okay, so, what do you need help with?

#

Oh, you would've to use Scanner#nextLine instead of Scanner#next

knotty marlin
#

If it has a hyphen it prints “this message comtains a hyphen”

pine parrot
#

oh, then use input.contains("-")

knotty marlin
#

Thank I

#

It worked