Created
November 17, 2015 12:18
-
-
Save SamDeBlock/863be52b9290c8856c37 to your computer and use it in GitHub Desktop.
Generics
This file contains hidden or 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
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