SCJP 6
SCJP 6
SCJP 6
SCJP 6
SCJP 5.0 100%
SCJP 6
It just means that the list can point towards any reference of super-type but addition is only allowed for
object of class B or sub-classes of B.
Am i right?So the list can contain only the reference of class B or subclasses of B.
Cheers Munees
My Blog
SCJP 6
public List go(List<? super B> la
Prithvi wrote
The list reference passed to the method can be any super type of B or B itself but the objects
that can be added to the collection can only be either B or sub-class of B.
Then why we pass the reference as <? super B>.Why don't we pass reference as<B>?
Cheers Munees
My Blog
ujjawal rohra wrote:Hii Prithvi
I havent got any schedule ..When i give a mock i catch my weakness on
a topic then start practising on it.Then again the same thing happens.
Additionally i am unable to concentrate for some days
If you are talking about the method signature, then it's generics way to let you add something
into a collection in a safe-way.
Ya.I aggree with you.But if we pass <B> instead of <? super B> also a safe-way. Am i right or not?
Cheers Munees
My Blog
Author of ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- OCPJP Online Training -- Twitter -- How to Ask a Question
You got style baby! More than this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|