So... you've got a few problems with your code... one really really bad thing is that you make each method throw an exception. that means you will never see if there are any errors. You were getting a bunch of nulls because you were storing values in an array of 50 and printing out each spot...
here is the fixed code. I left it as close to normal as possible
import java.util.*;
import java.io.*;
public class FranchiseManagementSystem
{
private BufferedReader br;
private String[] str;
public FranchiseManagementSystem() throws Exception
{
br = new BufferedReader(new FileReader("applicants.txt"));
str = new String[50];
readApplicantDetails();
}
private void readApplicantDetails() throws Exception
{
String thisLine = br.readLine();
int i = 0;
while (thisLine != null)
{
str[i] = thisLine;
thisLine = br.readLine();
i++;
}
if (i < 5)
{
System.out.println("Applicant entries are less than the minimum required number.");
}
else
{
for (int a=0; a<i; a++)
System.out.println(str[a]);
}
}
} nschessnerd
Posting Whiz in Training
216 posts since Dec 2006
Reputation Points: 10
Solved Threads: 8