I am trying to read a file using a string input as the filename. For example, if the filename is datafile.txt then if the input is "datafile.txt" and there is a file of that name in the directory, how do I read it? Here is my initial code:
Scanner kbd = new Scanner(System.in); String file = kbd.next();
then I have code further down as follows:
Caesar myCaesar = new Caesar(file);
However, it doesn't like the Caesar(file) because file is a string. Any help is much appreciated.