내가이 텍스트 파일에서 읽은 다음 내 배열에에 뭐죠 추가하려고이 방법을 가지고, 내 방법은 괜찮을 것 같다, 하지만 내가 내 프로그램을 받고있을 때 null 화면에 여기 내 코드입니다 도와주세요.자바 텍스트 파일에서 읽기 (문자열과 정수)
File text = new File("C:\\Users\\Stephen\\Desktop\\CA2\\src\\Management_System_Package\\GAMES.txt");
Scanner scnr = new Scanner(text);
String GameLine;
GameLine = scnr.nextLine();
while (scnr.hasNextLine()) {
Management_System Game = new Management_System("", "", 0, 0, 0);
int Comma1 = GameLine.indexOf(", ");
String Title = GameLine.substring(0, Comma1).trim();
Game.setTitle(Title);
System.out.print(Title);
int Comma2 = GameLine.indexOf(", ", Comma1 + 1);
String Genre = GameLine.substring(Comma1 + 1, Comma2);
Game.setGenre(Genre);
int Comma3 = GameLine.indexOf(", ", Comma2 + 1);
String ID = GameLine.substring(Comma2 + 1, Comma3);
Game.setID(Double.parseDouble(ID));
int Comma4 = GameLine.indexOf(", ", Comma3 + 1);
String Rating = GameLine.substring(Comma3 + 1, Comma4);
Game.setRating(Integer.parseInt(Rating));
String Quantity = GameLine.substring(Comma4 + 1).trim();
Game.setQuantity(Integer.parseInt(Quantity));
add(Game);
GameLine = in.nextLine();
이, 내가 텍스트 파일 – StephenJpH
자객 Cread, 액션, 1.0, 4, 5에서 읽으려고하고있는 무슨 -1 도움을 기꺼이 도움 – StephenJpH