Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

System.in.read()  RSS feed

 
Arun Prasath
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why doesn't the following snippet ask for input values 3 times
from the user input keyboard?
Rather ,its asks only for one time...and directly goes to the next
line following the loop.

for(int i=0;i<3;i++){
char c=(char)System.in.read();
}
 
Satyanarayana Veera Venkata
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

try increasing the loop count to 10

 
Satyanarayana Veera Venkata
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arun,

i am wondering how you could put the code snippet in normal font. after several tries i chose to put entire text as CODE, couldnt mix code and text.

Satya
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!