can any boy elaborate.
Originally posted by Peter den Haan:
Java 1.5 - currently in beta - introduces templates ("generics") into the language. If you're familar with C++, beware: they are reminiscent of C++ templates and are superficially similar, but they work quite differently under the hood.
In fact, Java does *not* use templates to implement generics.
C++ templates use a compile-time model. When a template is used in a C++ program, the effect is as if a sophisticated macro processor had been used.
Java generics (as well as C# generics) are not just a feature of the compiler, but also a feature of the runtime. A generic type such as List<T> maintains its generic-ness (genericity) after it has been compiled.