ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

Public void insert (List<? super Object> list){ }, which objects can be added to the list inside the method insert()?

user-image
تم إضافة السؤال من قبل himanshu mittal
تاريخ النشر: 2013/06/27
Javed Khan
من قبل Javed Khan , Senior Programmer Analyst , Barclays Technology

An instance of Object Class or any of its child classes.
But methods of objects will only be available and the object will be up-casted to Object.

Zabeer Sultan
من قبل Zabeer Sultan , Senior Technical Lead , Happiestminds

This list can accept any objects and it's equivalent to a non-generic list in that sense.
While retrieving the objects it comes implicitly as Objects and any casting needs to be done manually if required.

المزيد من الأسئلة المماثلة