~WOak
Thanks and Regards,
SCJP 1.5 (90%), SCWCD 1.5 (85%), The Jovial Java, java.util.concurrent tutorial
SCJP6.0,My blog Ranchers from Delhi
shanky sohar wrote:while using <? extends driver> list2......using extends means that you cannot add anything to a list....
because you donot know what is driver whether it is a interface or a class.......
because compiler doesnot know whether Driver is an interface or class
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Rob Prime wrote:
shanky sohar wrote:while using <? extends driver> list2......using extends means that you cannot add anything to a list....
With one exception: null
Rob Prime wrote:
shanky sohar wrote:while using <? extends driver> list2......using extends means that you cannot add anything to a list....
With one exception: null
because you donot know what is driver whether it is a interface or a class.......
because compiler doesnot know whether Driver is an interface or class
Sure it does. It knows that Driver is a class that extends Person. However, with "? extends Driver" the type could be Driver, StudentDriver, RaceCarDriver, or anything else that extends Driver. You don't know which one and that's why you can't add anything.
SCJP6.0,My blog Ranchers from Delhi
SCJP6.0,My blog Ranchers from Delhi
SCJP6.0,My blog Ranchers from Delhi
shanky sohar wrote:Thanks for correction...see i have edited my post with your correction......
David Newton wrote:
shanky sohar wrote:Thanks for correction...see i have edited my post with your correction......
Please don't do that; it makes things *very* confusing, particularly when you simply cut-and-paste somebody else's text and present it as your own.
SCJP6.0,My blog Ranchers from Delhi