Override: Signature[Method's name and argument] must be same.
and remember Generics are invariant [not Covariant]
Joined: Dec 10, 2009
everyone says that k&b explains genercis the best...but even after reading it 3-4 times am unable to solve many questions.....can anyone tell me where i can get generics questions and from where i can understand it better?
Generics provide compile time type safety, that means when the code is converted to the byte code all the type information is erased. At that time the strongly typed collection gets converted to old type less collections.
That means after the compilation of the following code
would get converted to following ..
which is same at the byte code level but at source code you are using the List as strongly type casted to different datatypes. Due to this conflict you get the compilation error in your code..