use java.io package
import java.io.*;
next you'll need an InputStreamReader to read from the System.in stream
Code:
InputStreamReader isr = new InputStreamReader(System.in) );
afterwards, you'll need a BufferedReader to store the stream
Code:
BufferedReader br = new BufferedReader(isr);
use the readLine() method to get a string
Code:
String sampleString = br.readLine();
put it all together
Code:
import java.io.*;
class RandomClass
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in) );
String sample = br.readLine()
}
Tuesday, October 20, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment