Skip to content

Instantly share code, notes, and snippets.

@pulsation
Created November 6, 2015 08:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pulsation/056cfff64aa05045a4c7 to your computer and use it in GitHub Desktop.
Save pulsation/056cfff64aa05045a4c7 to your computer and use it in GitHub Desktop.
class App {
public static class SuperClass {}
public static class SubClass extends SuperClass {}
public static <T, U extends T> U returnSub(T sup, U sub) {
return sub;
}
public static void main(String[] args) {
SuperClass parent = new SuperClass();
SubClass child = new SubClass();
returnSub(parent, child);
returnSub(child, parent); // Java doesn't like that
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment