-
-
Save deda9/928298d36d10d3a65c1ff8d5dd7aaadb 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