Skip to content

Instantly share code, notes, and snippets.

@diaolizhi
Last active September 29, 2018 10:45
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 diaolizhi/4d4efa0f76c97d6523d42881eb440d6c to your computer and use it in GitHub Desktop.
Save diaolizhi/4d4efa0f76c97d6523d42881eb440d6c to your computer and use it in GitHub Desktop.
创建指定含有泛型类型的类的数组
Stack<String>[] a = (Stack<String>[]) new Stack[N];
虽然 Stack 不是泛型类,但是它含有一个泛型参数。
所以下面这种方式会报错。
LinkStack<String>[] b = new LinkStack<String>[4];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment