Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

? about System.out.read()

 
Paul LaBrier
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a simple console application that I need to insert a pause in.
Basically I am wanting a "press any key to continu" type thing.
I thought that I should be able to do it with:
System.out.read()
but I cannot seem to get it to work.
I tried searching the internet and could find very little on this topic.
Any suggestions?
Paul LaBrier
 
Snigdha Solanki
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this

The program will print Hello and then pause for user input. If you hit the enter key "World" will get printed on screen.
Hope this helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic