Well your iteration makes sense, but you do not pass anything to displayTimetables(), so that is not going to print anything. Your call to new at objGetTimetable = new ObjectInputStream(inputTimetable); may or may not need a new inputTimetable, assuming each file in the dir is an independent data
unit then new on each one makes logical sense, but is not what I would think of as correct way to do it. Code that works and is efficient can be sought by considering the correct immplementation, which in this context probably sounds something like
processNextFileIntoTimeTableListing or some name that makes sense to you. I use random decay from outer space because I can realate to it better ( old joke for the wiley amoung us ) but one call to new should be effective if
objGetTimetable is passed to a function of that object that adds each files contents to some area.
You can either put them in a Collection if you will need to use them again or just print to JDisplay ( whatever the correct JFrame display area for your needs - JList can be an extremely powerful tool for displaying lists )
You need to pass the result of the function call:
new ObjectInputStream(inputTimetable); to someplace, probably the
displayTimetables(), but to stack them up first you probably want to accumulate them so it comes to code looking like.
while(nextFileAvailable()){
dumpOntoList(nextFile);
}
displayFiles();
// somewhere else
void displayFiles(){
while(listNotDone)print.nextLine();