Skip to content

Instantly share code, notes, and snippets.

@yanglikun
Created September 2, 2017 05:28
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 yanglikun/be1077281cc3ebbbf30620c05d64ed3a to your computer and use it in GitHub Desktop.
Save yanglikun/be1077281cc3ebbbf30620c05d64ed3a to your computer and use it in GitHub Desktop.
编译没错,运行时出错。和泛型有关
class A<T extends Comparable & List> {
public void test(T t) {
t.add("cc");
}
}
public class Test {
public static void main(String[] args) {
A a = new A();
a.test("a");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment