Govt Exams
Type parameters in Java must be declared before the return type using angle brackets. Option A has correct syntax: <T> comes before return type void.
Upper bounds (? extends T) are safe for reading because the compiler knows it's at least T. Lower bounds (? super T) are safe for writing because you can pass T or any superclass.
While convention uses single uppercase letters, type parameters can be any valid identifier. Statements B and D are also incorrect.
The value type is '? extends List<?>', so you get a List with unknown element type. The exact subtype is unknown at compile-time.
Multiple bounds (using &) mean T must satisfy all constraints. This is useful when a type needs to implement multiple interfaces.
The interface has two type parameters: K and V, making it a generic interface that can be implemented with different type combinations.
Arrays of generic types are not allowed in Java due to type erasure and heap pollution prevention.
How would you call this method for a List?
Type inference in Java allows the compiler to deduce T from the argument type, so both explicit and implicit type specification work.
Raw types (like 'List' without type parameters) are legacy and should be avoided as they bypass compile-time type safety.
Nested wildcards like '? extends ? super T' are not allowed. Wildcards cannot be combined or nested.