Ошибка появляется в строке 26
import java.util.*;
import java.io.*;
public class PG1gbm {
public static void main(String[] args) {
try {
File input = new File("input.txt");
Scanner infile = new Scanner(input);
Scanner i1 = new Scanner(input);
int count= 0;
while(infile.hasNext()) {
infile.nextLine();
count++;
}
User[] userArray = new User[count];
int loopCount = 0;
while(infile.hasNext()) {
//userArray[loopCount] = new User(i1.next(), Integer.parseInt(i1.next()), Integer.parseInt(i1.next()), Integer.parseInt(i1.next()),Integer.parseInt(i1.next()));
userArray[loopCount] = new User(i1.next(), i1.nextInt(), i1.nextInt(), i1.nextInt(), i1.nextInt());
//userArray[count] = user;
loopCount++;
}
for(int i = 0; i < count; i++) {
System.out.println(userArray[i].getid());
}
}
catch(FileNotFoundException e) {
System.out.println("There is no file present.");
}
}
}
Вот класс, который я извлекаю из
public class User
{
private String userID;
private int in_time;
private int out_time;
private int priority;
private int plotter_sheets;
public User (String id, int t1, int t2, int prio, int pc)
{
userID=id;
in_time=t1;
out_time=t2;
priority=prio;
plotter_sheets=pc;
}
return userID;
}
public int getintime(){
return in_time;
}
public int getouttime(){
return out_time;
}
public int getPriority(){
return priority;
}
public int getSheets(){
return plotter_sheets;
}
public String toString()
{
String description;
description = userID + "\t" + in_time + "\t"+ out_time +
"\t"+priority+"\t"+plotter_sheets;
return description;
}
}