Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

InputStream

 
kieveen
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Can anyone please help me with the following;
The System class declares the following variable
public static final InputStream in
The InputStream class here is abstract. System.in can now be used to get command line input.
The System class does not extend InputStream so how does this work??
 
scott irwin
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to read lines from System.in, you need something like this...
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
String userInput = bf.readLine();
You should get text when the enter key is hit.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic