Here is the code:
I am new to java and stackoverflow so please excuse any mistakes.
public class Actions {
private static String datesFileName = "./Dates.txt";
private static String actionsFileName = "./Actions.txt";
private static File datesFile = new File(datesFileName);
private static File actionsFile = new File(actionsFileName);
private static ArrayList<String[]> actions = new ArrayList<>();
private static ArrayList<Date> dates = new ArrayList<>();
public Actions() throws FileNotFoundException, ParseException {
txtToDates();
txtToActions();
}
public static void txtToActions() throws FileNotFoundException {
Scanner tempSc = new Scanner(actionsFile);
int counter = 0;
while(tempSc.hasNextLine()) {
actions.add(new String[24]);
for(int innerCounter=0; innerCounter<24; innerCounter++) {
actions.get(counter)[innerCounter] = tempSc.next();
}
counter++;
}
tempSc.close();
}
}
When i attempt to create an instance of said class in another class, i get a file not found exception. Why is that? Where is the error in the constructor and how can it be fixed? I am lost since I had similar methods with a similar class and it ran just fine.