what is generic class? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

what is generic class?

7th Dec 2017, 3:53 PM
Noush Rabah
Noush Rabah - avatar
3 Answers
+ 3
Java Generic methods and generic classes enable programmers to specify, with a single method declaration, a set of related methods, or with a single class declaration, a set of related types, respectively. Generics also provide compile-time type safety that allows programmers to catch invalid types at compile time.
7th Dec 2017, 4:04 PM
GAWEN STEASY
GAWEN STEASY - avatar
+ 1
Generic class enables the programmer to create classes,interfaces and methods in which type of data is specified as a parameter. It provides a facility to write an algorithm independent of any specific type of data. Generics also provide type safety. Type safety means ensuring that an operation is being performed on the right type of data before executing that operation.
7th Dec 2017, 7:13 PM
Rahul Y
Rahul Y - avatar
0
then whats the different between the generic method and generic class?
7th Dec 2017, 7:39 PM
Noush Rabah
Noush Rabah - avatar