import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Scanner;
public class Scheduler {
ProcessList processes = new ProcessList();
int NUM_PROCESSES;
int TOTAL_CPU_TIME = 0;
File randomNumbers = new File("random-numbers.txt");
Scanner numberScanner;
public void getInput(String args[]) throws FileNotFoundException{
Scanner inputScanner = new Scanner(System.in);
numberScanner = new Scanner(randomNumbers);
ArrayList<String> inputAsList = new ArrayList<String>();
while (inputScanner.hasNext()){
String nextInput = inputScanner.next();
inputAsList.add(nextInput);
}
inputScanner.close();
organizeInput(inputAsList);
}
}
每当我尝试为numberScanner重做时,我总是会收到此错误。我尝试不关闭其他扫描仪,inputScanner,正如其他问题中所建议的那样,但它没有解决问题。