package excersice1;import java.lang.reflect.Method;
import java.lang.reflect.Modifier;public class ReflectTest {
public static void main(String[] args) {
Class c=Interface1.class;
System.out.println("the modifier of interface1: "+Modifier.toString(c.getModifiers()));
Class c1=A.class;
System.out.println("the modifier of class A: "+Modifier.toString(c1.getModifiers()));
}
}class A
{
void g()
{
System.out.println("...");
}
}interface Interface1
{
public void f();
}===========================运行结果如下:
the modifier of interface1: abstract interface
the modifier of class A: 包访问权限的根本反映不出来,这实际使用中不是很那啥。
import java.lang.reflect.Modifier;public class ReflectTest {
public static void main(String[] args) {
Class c=Interface1.class;
System.out.println("the modifier of interface1: "+Modifier.toString(c.getModifiers()));
Class c1=A.class;
System.out.println("the modifier of class A: "+Modifier.toString(c1.getModifiers()));
}
}class A
{
void g()
{
System.out.println("...");
}
}interface Interface1
{
public void f();
}===========================运行结果如下:
the modifier of interface1: abstract interface
the modifier of class A: 包访问权限的根本反映不出来,这实际使用中不是很那啥。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货