Exception in thread "Animation Thread"
in
Programming Questions
•
9 months ago
Hi all, in my program I am trying to read in strings from a file. It seems to work fine, but it ends up giving me an error and I can't seem to figure out why.
and the error is
Here is the code:
- String q[] = loadStrings("Level1.txt");
- String[][] questions = new String[q.length][2];
- for (int i = 0; i < q.length; i++)
- {
- String[] sep = split(q[i], '\t');
- questions[i][0] = sep[0];
- questions[i][1] = sep[1];
- }
The file that I am reading in is tab-delimited and each line has two items, separated by a tab.
Exception in thread "Animation Thread" java.lang.ArrayIndexOutOfBoundsException: 1
at spacebar.Level1(spacebar.java:49)
at spacebar.draw(spacebar.java:37)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:662)
Thanks! :)
1