Page 1 - ADVANCED JAVA PROGRAMS
P. 1

ADVANCED JAVA PROGRAMS



                   1. WORDCOUNT


               import java .lang.*;


               import java.io.*;


               import java.util.*;

               class wordcount


               {


               public static void main(String args[])throws Exception

               {


               int char_count=0;


               int word_count=0;


               int line_count=0;

               String s;


               StringTokenizer st;

               BufferedReader buf=new BufferedReader(new InputStreamReader(System.in));


               System.out.println("Enter the filename:");


               s=buf.readLine();


               buf=new BufferedReader(new FileReader(s));

               while((s=buf.readLine())!=null)


               {


               line_count++;

               st=new StringTokenizer(s,",;:.");
   1   2   3   4   5   6