Java Program for counting Lines words and Characters in a File || Java Lab Programs || Java Tutorial
import java.io.*;
class CountingLWC
{
public static void main(String args[]) throws FileNotFoundException,IOException
{
int l=0,w=0,c=0;
BufferedReader br = new BufferedReader(new FileReader("INPUT.txt"));
String currLine = br.readLine();
while( currLine != null )
{
l++;
String words[] = currLine.split(" ");
w = w + words.length;
for(String word : words)
c = c + word.length();
c = c + (words.length - 1);
currLine = br.readLine();
}
System.out.println("No of Lines: " + l);
System.out.println("No of words: " + w);
System.out.println("No of Characters: " + c);
}
}
En esta página del sitio puede ver el video en línea Java Program for counting Lines words and Characters in a File || Java Lab Programs || Java Tutorial de Duración hora minuto segunda en buena calidad , que subió el usuario Join To Learn 04 marzo 2022, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 8,654 veces y le gustó 155 a los espectadores. Disfruta viendo!