What are Generics?

Generics:

Generics means Parameterized types . Parametarized types are important because they enables you to create classes, Interfaces, and the methods in e\which the type of a Data upon which they operate is Specified as a parameter.
Using f Generic's it is possible to create a single class,
for example that automatically works with the different types of a data,
  • A Class
  • Interface
  • Method
that operates on a Parametarized type is called "Generic". 
as in Generic class or a method, It is Important to understand that java has always given you the ability to create Generalized Classes,





Generics add the type safety that was Lacking.
they also Streamline the Process, Because it is no longer necessary to explicitly employ casts to  translate between Object & the type of a data that is actually being operated upon.
With Generic's, all casts are Automatically and implicit.
thus, Generics expand your ability to reuse code & let you do Safely & Easily"
Print this post
Previous
Next Post »