Static nested class(嵌套类)是将内部类声明为static.普通内部类对象隐式地保存了一个引用,指向创建它的外围类对象,不能有static数据和static字段。嵌套类意味着:1> 要创建嵌套类的对象,并不需要其外围类的对象;2>不能从嵌套类的对象中访问非静态的外围类的对象。
相关文章
- Java第三章习题3-7(1到n的阶乘和 /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author Administrator */ public class Find { public void main{ int n=9999; int sum=0; int k=1,i=1; for( i=1;i<=10;i++){ k=k*i; sum=sum+k; if(sum>9999){ break; } } (i-1); } } /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author Administrator */ public class Test { public static void main(String[] args){ Find f=new Find; ; } }
- 【Java面试题】11 什么是内部类?Static Nested Class 和 Inner Class的不同。
- Static Nested Class 和Inner Class的不同
- Static Nested Class 和 Inner Class的不同?
- Static Nested Class 和 Inner Class的不同
- 深入浅析Java中Static Class及静态内部类和非静态内部类的不同
- Swift中static和class关键字的深入讲解
- Static Nested Class 和 Inner Class的不同