169k views
2 votes
What is the primary benefit of writing generic classes and methods? Question 18 options: Generic classes and methods are more type-safe Generic classes and methods are shorter Generic classes and methods are faster Generic classes and methods are backwards compatible

User Imrank
by
5.5k points

1 Answer

3 votes

1.Generic code:

Reversibility principle says that write code in manner where you can use as much as you can and never ever reinvent the wheel ( never rewrite the code ). Not using generic code will result in redundant coding which means rewriting the lines again and again.

2.Methods :

1.Methods are again a nice way to use generic code.

2.Increase programming speed as many of languages methods uses cache memory.

3.Methods are called in stacks and thus uses less memory.

4. Structural programming is achieved by them.

User Juacala
by
6.0k points