We get the following error:
java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
For this code:
Scanner readyBoi;
ArrayList<Item> shopStock = new ArrayList<Item>();
public Shop(String stock){
this.readyBoi = new Scanner(stock);
while(readyBoi.hasNextLine()){
String temp = readyBoi.nextLine();
Tycoon.out(temp);
String tempArray[] = temp.split("\t", 5);
Item i = new Item(
Integer.parseInt(tempArray[0]),
Integer.parseInt(tempArray[1]),
Integer.parseInt(tempArray[2]),
tempArray[3],
tempArray[4]
);
this.shopStock.add(i);
}
}
This is the referenced item declaration:
Item(int id, int price, int generation, String name, String desc)
The code compiles correctly, but produces a runtime error.