JAVA Session08
JAVA Session08
Objectives
Read each line from the input stream and print to a file one line
at a time:
s = in.readLine();
out.println(s);
The application program can use the following methods of
the java.io package to read from a text file and display
each line on the standard output.
Create file:
File file = new File(args[0]);
Create a buffered reader to read each line from the keyboard:
BufferedReader in = new BufferedReader(new
FileReader(file));
Read each line from the file and displays it on the standard
output:
s = in.readLine();
System.out.println(s);
Lets see how to read data from a file and display the output on
the standard output device. This demo also shows how to run a
program with user provided command line arguments.
Lets see how to use the Collection API and generics in a Java
program.