Well done. I'm glad you've got it figured out.
Type: Posts; User: pbrockway2
Well done. I'm glad you've got it figured out.
As predicted the loop is seeing Betty Boop twice. And, hence I guess, adding Lily Mu twice which explains the other output.
If you can't see why, you need to step through the code one line at a...
It can only insert two people if g.getName().equals(s) is true twice. Try printing the index c and the corresponding student g each time around the loop to see why this is.
"work", I don't...
for(Student k : a)
{
if(k.getName().equals(s))
{
a.add(c, new Student(n, q, w, e, r, t));
}
c++;
}
The error is saying that you have run out of memory. It also suggests that an array list was "growing" ie you were adding something to the list at the time. In general - having figured out the...