I am trying to learn from one of the HeadFirst java books (Second Edition). The book has been very good except for some examples that I cannot get to work correctly. In chapter 16 the topic is to learn about generic classes and arrays as used in java 5.0. (I understand and can compile this concept correctly in 1.42.) The example is working correctly, but when I try to use an array element that is not the first one I get an array out of bounds error. Is there something that should be done differently? In the next example I also get the same kind of error "java.lang.ArrayIndexOutOfBoundException: 1". Although this is not the lesson for this chapter I do not think I should be getting this error. Below I have posted the code that give me the error. Please let me know if anyone has any idea of what I am encountering.
Any Help would be appreciated Thanks,
Bill Boyd (Edited by Bill Boyd 1:32 Saturday) [ January 27, 2007: Message edited by: Bill Boyd ]
Dear Barry, Thank you for your reply. I edited the curly brace out of my first posting by mistake. After I put the missing curly brace back into the code it ran just fine. I still got the same error, with this example and the code example in the HeadFirst book after it too. The next example had a text file that I also made from scratch. I made an entirely new data file and did not get the error that I had earlier. I must have had an issue with the way the text file saved. Again thanks for the reply.
Bill Boyd "Never Underestimate the Stupidity of the General Public"