illustrate
1. Define the in variable and use the upper limit wildcard character.
Use the extends keyword.
2. Use the super keyword and the lower limit wildcard to define the out variable.
3. If the In variable can be accessed using methods defined in the Object class, use unbounded wildcards.
4. When the code needs to access In and out variables, do not use wildcards.
Example
// natural number class NaturalNumber { private int i; public NaturalNumber(int i) { this.i = i; } // ... } // Even class EvenNumber extends NaturalNumber { public EvenNumber(int i) { super(i); } // ... }
The above are the rules for using wildcards in Java. I hope it will be helpful to everyone.