So I have all these methods that I need to run for multiple files through command line arguments.

How to I get it to allow more than one file?
I know how to get it to work with one file by just using String first = args[0];

The code I tried for multiple files is:

import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;


public class ProcessText 
{

	public static void main( String [] args) throws NullPointerException, IOException, ArrayIndexOutOfBoundsException
    {

 	int i=args.length;
	String first = args[i];

	
	TextStatistics fileZ = new TextStatistics ();
	fileZ.wordcounter(first);
	fileZ.lineCounter(first);
	fileZ.charCounter(first);
	fileZ.avgWordLength();
	fileZ.letterCount(first);
	fileZ.wordFreq(first);
        System.out.println("Results: " + "\n" + fileZ);
    }


}

Does array length rings a bell? args.length

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.