Skip to content

Instantly share code, notes, and snippets.

@SamDeBlock
Created November 17, 2015 12:18
Show Gist options
  • Save SamDeBlock/863be52b9290c8856c37 to your computer and use it in GitHub Desktop.
Save SamDeBlock/863be52b9290c8856c37 to your computer and use it in GitHub Desktop.
Generics
public class Generics {
static class Foo<T, R> {
public void bar(T arg) {
System.out.println("T " + arg);
}
public void bar(R arg) {
System.out.println("R " + arg);
}
}
public static void main(String[] args) {
Foo foo = new Foo<String, Long>();
foo.bar("abc");
foo.bar(123);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment