This week's book giveaway is in the Agile forum.
We're giving away four copies of Head First Agile and have Andrew Stellman & Jennifer Greene on-line!
See this thread for details.
Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Error with System.in reading prgm  RSS feed

 
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 Foreman
Posts: 2240
28
  • 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
Boost this thread!