Ask coding questions

← Back to all posts
I dont understand what to do!
xMisbahx (4)

Ok, so I'm kind of new to Java. I know enough to make a simple program, but nothing further than that. I was bored so I made a simplish program, but I keep running into a wall with this one part:

If someone could please tell me what I'm doing wrong/ how to fix it I would appreciate it!

Answered by xxpertHacker (934) [earned 5 cycles]
View Answer
xxpertHacker (934)

scan1.nextInt is expecting an integer, you gave it text "yeanay"

If you want to accept "yea" or "nay," then read a string, and compare using string equality.