-1
아래의 파일 .txt
에서 데이터를 읽는 방법을 모르겠습니다.fileReader 및 scanner
static final String DATA_PATH = "DataFile.txt";
public static void main(String[] args) {
Scanner fileReader = null;
try {
fileReader = new Scanner(new File(DATA_PATH));
//Print out a trace of the program as it is running
System.out.println("Debug: Scanner is open "+fileReader);
} catch (FileNotFoundException e) {
// If the file is not there, an exception will be thrown and the program flow
// will directed here. An error message is displayed and the program stops.
System.out.println("The file "+DATA_PATH+" was not found!");
System.out.println("The program terminates now.");
System.exit(0);
}
정말요? 당신은 심지어 운동 번호를 유지했습니다. – meda
모험심은 어디에 있습니까? :)'Scanner' 클래스 (web || 텍스트 북)에 대한 문서를 살펴보면, 마지막에'fileReader. '와 같이 마침표가있는 변수를 입력한다고해도 IntelliSense가 열리고 몇 가지 아이디어가 있어야합니다. (나는 단지'stackoverflow를 시작하면서'-1') –