The code I want to read from is called “textfile.txt”, now how do I pass this file as an argument in a parameter?
Pseudo code:
readsomething(textfile);
void readsomething(String reading) {
Scanner input = new Scanner(new File(reading));
bla bla bla
bla bla bla
}
I have tried several variations of the above code, every time I get an error saying identifier is requires for readsomething(textfile);
i am assuming that textfile parameter is a String (path to the file like “C:/abcfile.txt”).
refer to Scanner API