198k views
5 votes
The key benefit of generics is to enable errors to be detected at ______ time rather than ______ time.

1) compile, runtime
2) runtime, compile
3) design, implementation
4) implementation, design

1 Answer

7 votes

Final answer:

The key benefit of generics is to enable errors to be detected at compile time rather than runtime time.

Step-by-step explanation:

The correct answer is 1) compile, runtime. Generics are a feature in many programming languages that allow code to be written with placeholder types, which can then be specified when the code is used. This helps in creating type-safe code where type compatibility errors are caught during compile time rather than at runtime, which can save developers from encountering unexpected errors and crashes when the application is running.

User Milad Elyasi
by
8.7k points