|
|
Submitted by Rahimv on Wed, 08/25/2010 - 17:12
/*
Create a program which prints number of lines in the file. File name
should be supplied using command line argument.
*/
import java.io.*;
class CountNumberOfLinesFile
{
public static void main(String args[])
{
try
{
FileReader fr = new FileReader(args[0]);
BufferedReader br = new BufferedReader(fr);
String line;
int count = 0;
|
|
|
Submitted by Rahimv on Wed, 08/25/2010 - 13:12
/*
* Create a program which reads line from console and prints number of characters. Program
* should read the line from keyboard. Use BufferedReader for reading the line from console.
*/
import java.io.*;
class ReadFromKeyboard
{
public static void main(String args[])
{
try
{
DataInputStream din = new DataInputStream(System.in);
|
|
|
Submitted by Rahimv on Wed, 08/25/2010 - 13:03
/*
Create a program which reads file using readLine method of BufferedReader class. File name
should be supplied using command line argument.
*/
import java.io.*;
class BufferedReaderDemo
{
public static void main(String args[])
{
try
{
FileReader fr = new FileReader(args[0]);
BufferedReader br = new BufferedReader(fr);
String line;
|
|