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);
}
}
Sur cette page du site, vous pouvez voir la vidéo en ligne Java Program for counting Lines words and Characters in a File || Java Lab Programs || Java Tutorial durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Join To Learn 04 mars 2022, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 8,654 fois et il a aimé 155 téléspectateurs. Bon visionnage!