Hi Rakesh Buddy,
In KB's book , there is a section about declaring generic type in constructor just like your program.
First of all, in this code: SomeGenericClass<String> i = new <String>SomeGenericClass ("adsf", new Long(10)); T is the String. The Long object is the E.
The compiler does not know what E type is until you pass in the Long. Try this :
SomeGenericClass<String> i = new <String>SomeGenericClass ("adsf", new Double(10));
It compiles.
Rakesh K. Cherukuri wrote:Hi,
While looking at the generics mechanism ended up writing the following code.