Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ch.claude_martin;
- import java.util.*;
- public class SomeClass {
- public static void main(String args[]) {
- final class A<T> {
- private T value;
- public A(T value) {
- this.value = value;
- }
- public T getValue() {
- return value;
- }
- }
- A<? extends Number> a1 = new A<>(42);
- System.out.println(a1.getValue());
- A<? super ArrayList<Integer>> a2 = new A<>(new LinkedList<Number>(Arrays.asList(1.2, Math.PI, -0)));
- System.out.println(a2.getValue());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement