How to use java upper bound wildcards
This article mainly introduces the relevant knowledge of "how to use java upper bound wildcards". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "how to use java upper bound wildcards" can help you solve the problem.
Description
1. Upper-limit wildcards can be used to relax restrictions on variables.
For example, suppose you want to write a method that handles List, List, and List, then you can do this by using upper-bound wildcards.
2. The class instantiated by the upper wildcard must be the current class or a subclass of the current class.
3. If you want to declare upper-bound wildcards, use wildcard values.
Then there is the extends keyword, and finally its upper bound. Note that in the context, extends is generally used to represent extends (such as a class) or implements (such as an interface).
Example
Public static void process (List