我似乎无法弄清楚是什么导致了以下错误“线程“主”java.lang.ArrayIndexOutOfBoundsException: 1 at Bank.main(Bank.java:42) <--- 这行是指代码行开头为“banklist.add(new Bank(values[0]....”
public static void main (String[] args) throws FileNotFoundException
{
FileReader fr = new FileReader("Bank Data.txt");
BufferedReader reader = new BufferedReader(fr);
List<Bank> banklist = new ArrayList<Bank>();
try {
String line;
while ((line = reader.readLine()) != null)
{
String[] values = line.split("/t"); // Split on "tab"
banklist.add(new Bank(values[0], Integer.parseInt(values[1]),Integer.parseInt(values[2]),Integer.parseInt(values[3]),Integer.parseInt(values[4]), values[5])); // Create a new Player object with the values extract and add it to the list