Generics also provide compile-time type safety that allows programmers to catch invalid types at compile time.
It would be nice if we could write a single sort method that could sort the elements in an Integer array, a String array or an array of any type that supports ordering.
we can print array of different type using a single Generic method
http://tutorials.jenkov.com/java-generics/implementing-iterable.html
http://www.oracle.com/technetwork/articles/javase/generics-136597.html
http://www.tutorialspoint.com/java/java_generics.htm
Sunday, December 4, 2011
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment