1.

What are generic methods?(a) Generic methods are the methods defined in a generic class(b) Generic methods are the methods that extend generic class methods(c) Generic methods are methods that introduce their own type parameters(d) Generic methods are methods that take void parametersI got this question in exam.I'd like to ask this question from Generic Methods topic in division Generics of Java

Answer»

Correct choice is (c) GENERIC methods are methods that introduce their own TYPE parameters

Explanation: Generic methods are methods that introduce their own type parameters. This is similar to declaring a generic type, but the type parameter SCOPE is limited to the method where it is declared. STATIC and non-static generic methods are ALLOWED, as well as generic class constructors.



Discussion

No Comment Found

Related InterviewSolutions