This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
we can add anything which is super of D. it is declared in the LHS of duane. what about the actual object side(RHS) ArrayList<A>() means what? why we need to say this? when we can add all super of D and even retrieve it without run time exception.
Joined: Jun 04, 2007
Originally posted by samura babu: we can add anything which is super of D.
That is not correct. The super keyword refers to the lists that can be used. Have a look at the following sample.As you can see, it would be easy to add an element of the wrong type. The only type that is valid for all possible lists is D.