Skip to content

Instantly share code, notes, and snippets.

@diaolizhi
Created October 13, 2018 11:23
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/8708eefaffc336d0563350dbcd1c6317 to your computer and use it in GitHub Desktop.
Save diaolizhi/8708eefaffc336d0563350dbcd1c6317 to your computer and use it in GitHub Desktop.
创建泛型类中内部类对象
//内部类依赖于外部类,所以要先创建外部类对象
//第一种方式:
Outter outter = new Outter();
Outter.Inner inner = outter.new Inner(); //必须通过Outter对象来创建
//第二种方式:
Outter.Inner inner1 = outter.getInnerInstance();
//如果外部类是泛型类,可以这么写
Outter<String>.Inner inner1 = outter.getInnerInstance();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment