Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialannient
Courses Plus Student 1,708 PointsException in thread "main" java.lang.ArrayIndexOutOfBoundsExcept
I tried to see if method importTo() in SongBook file work if I have songs.txt. This is what I got:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsExcept
ion: 1
at com.teamtreehouse.model.SongBook.importFrom(SongBook.
java:43)
at Karaoke.main(Karaoke.java:17)
Please help :(
Philip Gales
15,193 PointsTake a snapshot of your workspace file by clicking on the camera in the upper right. Then you can share the link when you view the snapshot. I suspect it is your songs.txt file.
2 Answers
Philip Gales
15,193 PointsIf you "fork snapshot" you will be able to use it without having to copy my code. Your snapshot is incomplete and has a lot of errors.
The problem was your songs.txt file. It had some blank lines that were causing the error.
annient
Courses Plus Student 1,708 PointsThanks. I fixed song.txt file and it works. :)
Rashadat Mirzayev
14,601 PointsHi, annient. How did you fix the problem, cause I have the same? Can you share pls
annient
Courses Plus Student 1,708 Pointsannient
Courses Plus Student 1,708 PointsHere is my Karaoke.java file:
And my SongBook.java file: