in Core Java

Why Polymorphism does not help and we need Generics

Why we cannot use super types which can refer to some subtypes so that we can keep the classes Generics? The answer is that using Super types or Object as reference does not help. There will be issues with type casting and it is not an effective way to make code generic and reusable.
This is the reason why generics were introduced and they are extremely helpful in defining the reusable chunks of code.
In this video i gave a real world example to explain why we need generics in java

Srinivas Reddy

Srinivas Reddy

An IT - Specialist with loads of experience in Java, J2ee platforms and loves to share his experience on technology with You...

More Posts - Website

Follow Me:
TwitterFacebook

Srinivas Reddy
Written By:

An IT - Specialist with loads of experience in Java, J2ee platforms and loves to share his experience on technology with You...