Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Scanner Strings and Ints dont play nice

 
Bryce Heath
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys
I wanted to check this before I start researching into something thats not my problem
in the code

It seems if I use a string with anything else IE double int the string in the variable name does not print. If I both scans as ints or 1 int 1 double ect it prints fine. If I understood an earlier post it is a problem with the scan.nextLine I am using. I did look at some links provided for me but could not make heads or tails of it, and would like to know what specifically the code is doing when it does the scan.nextLine or even better if any 1 has a link to a good Scanner tutorial so I may understand a little better. Sorry Campbell if it seems im not putting in an effort on this problem but I have been googleing for hrs now and am a little frustrated, I hope this is not viewed badly.
Thank you again everyone for your continued patience with me, I know it can be annoying when people dont understand something.
 
Bryce Heath
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Omg Now I feel really dumb, moments after posting this I figured it out. The .nextLine was not printing the string because the string was never skipped (not sure how a string could be skipped?) but by using just next it works fine. Sorry for the trouble, glad I got it figured out.
 
Campbell Ritchie
Sheriff
Pie
Posts: 48981
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Back to your previous thread, where I warned you about nextLine(). Have a look at the previous link in that post, and see whether that helps you about nextLine().
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic