Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Item<T extends Comparable<? super T>> implements
- Comparable<Item<T>> {
- @Override
- public int compareTo(Item<T> o) {
- // TODO Auto-generated method stub
- return 0;
- }
- }
- public class ItemCont<T extends Item<T>> {
- public static void main(String[] args) {
- Item<Integer> it = new Item<Integer>(); //ok
- ItemCont<Item<Integer>> cont = new ItemCont<Item<Integer>>(); // Error
- // Bound mismatch: The type Item<Integer> is not a valid substitute for the bounded parameter <T exten
- // ds Item<T>> of the type ItemCont<T>
- }
- }
Add Comment
Please, Sign In to add comment