• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Scanner Strings and Ints dont play nice

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 77168
370
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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().
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic