• Post Reply Bookmark Topic Watch Topic
  • New Topic

I'm an absolute newbie and I was trying to make this code for fun but it's not working  RSS feed

 
Samaira Rahman
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

 
Knute Snortum
Sheriff
Posts: 4270
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

There is no keyword or variable called yes. What you probably want is true.


The method next() is problematic in Scanner. Try nextLine().


With nextBoolean() you can only type "true" or "false", not "yes" or "no" or "y" or "n", etc. Just FYI.
 
Campbell Ritchie
Marshal
Posts: 56518
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never write == true or == false which are both poor style and error‑prone (you might write = by mistake). It is
if (birthMatch && swordMatch && bloodMatch) ...
Most people have problems with nextLine if used after nextAnythingElse. As long as you use nextLine before nextAnythingElse you will be all right.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!