This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Originally posted by karl holmgren: I am getting a null pointer exception for the last line of code, why? ...
I would need to see more of the code, but my guess is that channels[ch] is simply referencing a null value at some point (that is, there's no Vector object at the array index). [ October 11, 2005: Message edited by: marc weber ]
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
Ernest Friedman-Hill
author and iconoclast
Marshal
You are indeed allowed to put Vectors into arrays. Java is complaining because you haven't done so! The line
private Vector channels = new Vector[noCh+1];
allocates an array of Vector variables -- i.e, references to Vectors. There are no Vectors in the array, though -- all those variables are null. You have to actually allocate the Vectors:
Then you can call size() on them.
If this is confusing you, have a look at this and this. [ October 11, 2005: Message edited by: Ernest Friedman-Hill ]