8
Generic Implementations
•If the implementation is identical except for the basic type, then Object type is used to get generic implementations. •This is the equivalent of “template” in C++; every reference type is compatible with the Object type. •When specific methods of the object are needed, then we need to“downcast” to the correct type. •If a class does not extend another class, it extends the class Object. It is class (not abstract) with several methods including toString().
•
•If a method required is not available in Object, then generic implementations can be achieved using interface.