• Post Reply Bookmark Topic Watch Topic
  • New Topic

howto use nextLine()  RSS feed

 
camilla sandgren
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've the method below:



But it doesn't work the way I want, I get name and race at the same line, whithout having the possibility to type the name?? Like this:
name: race:

Any ideas what might be wrong?
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will have to give us more information: What class is sc an instance of? Where is its application programming interface (api) documented?
[ October 23, 2005: Message edited by: Barry Gaunt ]
 
Kenneth Albertson
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's a Scanner. This will do the job if the user types in exactly what is expected:And this will do it even if they put extra junk on the inputs:
 
camilla sandgren
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It worked Thank you!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!