Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Scanner debugging help

 
Haani Naz
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I have the following piece of code which fails at the point it needs to accept input and i can't seem to figure out why.






The issue is at line 115.


Here is the output:



As you can see instead accepting input it skips it.

can somebody please tell me why?

thanks in advance!
 
Anniruddh Rana
Greenhorn
Posts: 18
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Change that to



and give it a try.

i.e. use System.out.print there instead of System.out.println
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic