i want to read lines in a file as paragraph. for example if there are lines of text without empty space between them it should treat it as 1 paragraph and then i want to count the words.
So far it count the words correctly but doesn't recognise lines of text as a paragraph. Java beginner
Scanner file = new Scanner(new FileInputStream("/.../output.txt"));
int count = 0;
while (file.hasNextLine()) {
String s = file.nextLine();
count++;
if(s.contains("#AVFC")){
System.out.printf("There are %d words on this line ", s.split("\\s").length-1);
System.out.println(count);
}
}
file.close();