日期:2014-05-20  浏览次数:20682 次

请问接口里的内部类是否默认就是public static final的?
请问接口里的内部类是否默认就是public   static   final的?
麻烦设计个测试,谢谢~

------解决方案--------------------
package com.tbtech.aivi.cache;

/**
* <p> Title: AIvi-Magic </p>
*
* <p> Description: </p>
*
* <p> Copyright: Copyright (c) 2006 </p>
*
* <p> Company: </p> not attributable
*/
public interface InnerClassInterface{

class InnerClass {

public static void println(){
System.out.println( "TEST----------- ");
}

}
}

package com.tbtech.aivi.cache;

/**
* <p> Title: AIvi-Magic </p>
*
* <p> Description: </p>
*
* <p> Copyright: Copyright (c) 2006 </p>
*
* <p> Company: </p> not attributable
*/
public class ImplementsClass implements InnerClassInterface {

public static void main(String args[]){
ImplementsClass.InnerClass.println();
InnerClassInterface.InnerClass.println();
}

static class InnerClass {
public static void println(){
System.out.println( "TEST-HHH---------- ");
}
}
}
------解决方案--------------------
public class Test {

/**
* @param args
*/
public static void main(String[] args) throws Exception {

Class hello = Hello.A.class;
int i = hello.getModifiers();
System.out.println(i);
System.out.println(Modifier.isPublic(i));
System.out.println(Modifier.isStatic(i));
System.out.println(Modifier.isFinal(i));
}

}


interface Hello {

class A {

}

}

用反设计就知道了
默认就public static(一定是的)
但final 不是默认的