I am currently writing a program to read in data from a text file and utilize the data in some way. So far I can read the file no problem but the issue I am having is with what comes next. As the data is read from the text file the appropriate objects must be created, from classes that I have already built, and stored in 2 arrays based upon the data. As I said before I have the code for the data to be read completed but I do not know how to use that data to create objects and to store those objects into arrays.
Here is the code that I have so far in the main method:
public static void main(String[] args) {
BufferedReader inputStream = null;
String fileLine;
try {
inputStream = new BufferedReader(new FileReader("EmployeeData.txt"));
System.out.println("Employee Data:");
// Read one Line using BufferedReader
while ((fileLine = inputStream.readLine()) != null) {
System.out.println(fileLine);
}//end while
} catch (IOException io) {
System.out.println("File IO exception" + io.getMessage());
}finally {
// Need another catch for closing
// the streams
try {
if (inputStream != null) {
inputStream.close();
}
} catch (IOException io) {
System.out.println("Issue closing the Files" + io.getMessage());
}//end catch
}//end finally
}//end main method
whileloop you can create the objects and add them to the arrays.