How do I read a line of input at a time in Java?
The standard input stream is represented by the InputStream object System.in. For reading a whole line at a time BufferedReader is chained to an InputStreamReader that in turn is chained to System.in.
For example: This program read line from a file “students” and displays it on screen.
public class stud
public static void main (String args[ ]) throws IOException
BufferedReader br= new BufferedReader(new InputStreamReader(newFileInputStream(“students”)));
String s= “”;
while ((s= br.readLine())!=null) System.out.println(s);
catch (IOException e)