Created
October 7, 2014 10:14
-
-
Save lucamolteni/956e9e4ce1432a30b979 to your computer and use it in GitHub Desktop.
Fun with generics
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package it.lm; | |
public class Main { | |
public static void main(String[] args) { | |
B b = new B(); | |
A<B> a = new A<B>(b); | |
C<A<B>> c = new C<A<B>>(a); | |
} | |
} | |
class B { | |
} | |
class A<S extends B> { | |
B s; | |
A(B s) { | |
this.s = s; | |
} | |
} | |
class C<S2 extends A<B>> { | |
A<B> a; | |
C(A<B> a) { | |
this.a = a; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment