Here is the code, the class is down below.
import java.text.*;
import java.io.*; // needed to access input stream classes
public class process
{
static BufferedReader keyboard =
new BufferedReader(new InputStreamReader(System.in));
public static void main(String[] args)
throws java.io.IOException
{
Help[] list= new Help[100];
int count = 0;
String input;
System.out.print("Enter text file name to read from: ");
input = keyboard.readLine();
holdData(input,list, count);
}
static void holdData(String fileName, Help array[], int c) throws IOException
{
FileReader reader = new FileReader (fileName);
BufferedReader infile = new BufferedReader (reader);
String store;
store = infile.readLine ();
array[c] = new Help(store);
while (store != null) // while not end of file
{
store = infile.readLine();
c++;
array[c] = new Help(store); // is this statement going to store the words?
}
}
the created class, merged
class Help
{
private int count;
private String read;
public int getCount()
{
return count;
}
public Help (String len)
{
read = len;
count = 1;
}
public String getHelp ()
{
return read;
}
}

New Topic/Question
Reply




MultiQuote





|