Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error with System.in reading prgm

 
George Han
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Thats my code, I tried to do some tests, I first typed 3, so I get to the "That was Not a Name, If you wish to Quit press q or Q" part, But To test it will loop after I press d, instead of Q or q, But IT gives "Enter Name as Last, First I. " And I cant type anything All it gives is this _
 
Norm Radder
Ranch Hand
Posts: 728
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To help you see what is happening in your code you need to display the values of the variables. Put some System.out.println() statements in the code that display the contents of all the variables so you can see how they are changed.

Questions regarding your code:
what is the purpose of the variable: counter? Why do you change its value?
What is Yay used for? The name doesn't mean anything. Would a better name be loopControl?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic