For an assignment I’m coding, we have to include print statements that tell us what file is being worked on. However, all that is passed in the methods that is in anyway related to the file is the FileReader.
The file names are taken from string args in the main method, this method then creates the file reader and passes it to the methods. Rules of the assignment mean we are not able to edit the main methods, or our method headers.
So my question is is there a way to backtrack through a file reader to get a string name?
EDIT: Talked to the lecturer, he said to; ‘use the string arguments’, the ones that are only passed to the readers and writers.
EDIT2: Lecturer messed up, ended up allowing us to edit the main methods.
I’d write another class with it’s own static void main(String[]). The method would capture and print the arguments then call the original main() method. Technically that doesn’t violate the rules.