A generic type can be bounded with multiple class data types. The class types that qualify are subclasses of a specified data type or implementations of an interface. For example, we might wish to create a vector or array list and call a method in a generic class to process the data. Both the ArrayList and Vector classes are implementations of the List interface. Therefore the bounds of the generic parameter are the implementations of List. To learn how to write type parameters with multiple bounds in Java, follow these four steps.

Leave a Reply

Your email address will not be published. Required fields are marked *