I often use the Scanner class to read files because it is so convenient.
String inputFileName;
Scanner fileScanner;
inputFileName = "input.txt";
fileScanner = new Scanner (new File(inputFileName));
My question is, does the above statement load the entire file into memory at once? Or do subsequent calls on the fileScanner like
fileScanner.nextLine();
read from the file (i.e. from external storage and not from memory)? I ask because I am concerned about what might happen if the file is too huge to be read into memory all at once. Thanks.