Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

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

user-image
Question added by himanshu mittal
Date Posted: 2013/06/27
Javed Khan
by 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
by 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