i need help to count lines, paragraphs and articles ("a","an","the") in txt file with java. here is what i've got know:
import java.io.*;
import java.util.*;
public class Main
{
public static void main ( String[] args ) throws FileNotFoundException, IOException
{
String line=" ";
char t=9;
String s=""+t;
int lines = 0;
int para=0;
Scanner scan =new Scanner (new File ("G:/data.txt"));
while (scan.hasNext())
{
line = scan.nextLine();
if (line.contains(s))
{
para++;
}
if (line!=null)
lines++;
}
System.out.println("the nnumber of paragraphs is:"+para);
System.out.println("The number of lines is:"+lines);
}
}