Counting the nos. of lines in a file is simple, you first create a FileReader
class object on the file that you want to use... then wrap this with
BufferedReader class object... now run a while loop and read the content of the
file line by line and increment a counter inside the loop. at the end of the
loop the counter will give the number of lines in the file...
eg
consider your input file is input.txt
write this code in the main method
{
int count = 0;
FileReader fr = new FileReader("input.txt";
BufferedReader br = new BufferedReader(fr);
while(br.readLine() != null)
count++;
System.out.println("The Number of lines in the file is : " + count);
}