Home » JAVA Programming » Generics » Question
  1. What is use of wildcards?
    1. It is used for type argument of generic method
    2. It is used to access members of super class
    3. It is used to make code more readable
    4. It is used in cases when type being operated upon is not known
    5. None of these
Correct Option: D

The wildcard can be used in a variety of situations: as the type of a parameter, field, or local variable; sometimes as a return type (though it is better programming practice to be more specific). The wildcard is never used as a type argument for a generic method invocation, a generic class instance creation, or a supertype.



Your comments will be displayed only after manual approval.