22) Write a java program that displays the number of characters, lines & words from a file.

import java.io.*;
class FilereadDemo
public static void main(String args[]) throws Exception
int ccnt=0,lcnt=1,wcnt=1,c;
FileInputStream fin=new FileInputStream(args[0]);
if(c==32 || c==13)
System.out.println(“Number of Characters are ” + ccnt);
System.out.println(“Number of Words are ” + wcnt);
System.out.println(“Number of Lines are ” + lcnt);

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s