Manikandan Thiagarajan
asked on
generics problemis to avoid type cast problem is i correct
generics problemis to avoid type cast problem is it correct
any way explain advanages of generics
any way explain advanages of generics
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Generics' intention is to avoid type cast problems during runtime . By using generics , you can strictly specify with which types you want your routine to work . The compiler restricts clients(callers) to use the routine by passing only those types and nothing else . Thus , compiler makes that type checking instead of the runtime . So ,if you have any bad callers , then it is detected at compile time instead of ending up with a surprise at runtime.
ASKER
is it jdkk1.5 feature or jdk1.6 features
I'm sure you'd agree that we can use the function defined immediately above because it is designed to take in only ints.That was supposed to say "can not" in my comment.
is it jdkk1.5 feature or jdk1.6 featuresAccording to Wiki, they came with Java 5.
2. http://www.javaworld.com/javaworld/jw-06-2001/j1-01-sintes3.html?page=1
3. http://www.javacodegeeks.com/2011/04/java-generics-quick-tutorial.html