Created
September 2, 2017 05:28
-
-
Save yanglikun/be1077281cc3ebbbf30620c05d64ed3a to your computer and use it in GitHub Desktop.
编译没错,运行时出错。和泛型有关
This file contains 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
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