Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

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

user-image
Question ajoutée par himanshu mittal
Date de publication: 2013/06/27
Javed Khan
par 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
par 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.

More Questions Like This