Generics


  1. What is use of wildcards?











  1. View Hint View Answer Discuss in Forum

    NA

    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.


  1. Which of these keywords is used to upper bound a wildcard?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    extends



  1. Which of these is an correct way making a list that is upper bounded by class Number?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    List


  1. Which of the following keywords are used for lower bounding a wild card?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    A lower bounded wildcard is expressed using the wildcard character (‘?’), following by the super keyword, followed by its lower bound.