I am trying to read a text file into a binary tree by using delimiters to separate the different fields. When I try to read it into the binary tree I get the array out of bounds erropackage Hospital;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;`
public class main {
public static void main(String args[]) throws IOException
{
BufferedReader in = new BufferedReader(new FileReader("patient.txt"));
String line;
BinaryTree hospital = new BinaryTree();
while ((line = in.readLine()) != null) {
String[]text = line.split(",");
hospital.insert(text[0], text[1], text[2], text[3], text[4]);
}
in.close();
}
}