Easy learning with example program codes

Wildcard in generics


In generics ‘?’ is known as wildcard and it represents an unknown type.

Types of wildcard:

  1. Unbounded wildcard.
  2. Bounded wildcard.
    1. Upper bounded wildcard.
    2. Lower bounded wildcard.

Unbounded used for list of unknown types using ‘?’(Type is not bounded).
2. Bounded wildcard: is used for unknown bounded types using ‘?’ with extends or super keyword.

  1. Upper bounded wildcard. is used to restrict the unknown type to be a specific type or a subtype of that type using ‘?’ with extends keyword.
  2. Lower bounded wildcard. is used to restrict the unknown type to be a specific type or a super type of that type using ‘?’ with super keyword.

Next Topic: Unbounded wildcard.
Previous Topic: ClassCastException at runtime test.

Related Topics:

How to build java project using ant in eclipse?
JAXB marshalling – convert java object to xml example.
How to create pdf file in java using iText jar?
Generics class example.
OGNL in struts 2.
Hibernate One-to-One Mapping using xml.
Send inline image in email using JavaMail API.
Quartz 2 JobListener example.


Sign Up/ Sign In
Ask a Question

Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at


We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on

Copyright © 2018 CodesJava Protection Status SiteMap Reference: Java Wiki