摘要: 一 ,调用无参方法: import java.lang.reflect.Method; public class InvokeSayJapanDemo { public static void main(String[] args) { Class c1=null; try { c1=Class.forName(PersonZ.cla... 阅读全文
posted @ 2014-09-03 17:47 塔斯曼 阅读(194) 评论(0) 推荐(0) 编辑
摘要: interface China { public static final String NATIONAL = "JAPAN"; public static final String AUTHOR = "SIGERU"; public void sayJapan(); public String sayHello(String name, int ag... 阅读全文
posted @ 2014-09-03 17:14 塔斯曼 阅读(296) 评论(0) 推荐(0) 编辑
摘要: import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; class Person { private String name; private int age; public Person(String name, int age) ... 阅读全文
posted @ 2014-09-03 16:27 塔斯曼 阅读(1023) 评论(0) 推荐(0) 编辑
摘要: class X { } public class GetClassDemo01 { public static void main(String[] args) { X x = new X(); System.out.println(x.getClass().getName()); Class c1=... 阅读全文
posted @ 2014-09-03 16:12 塔斯曼 阅读(413) 评论(0) 推荐(0) 编辑
摘要: enum ColorE { RED, GREEN, BLUE; } public class GetEnumContent { public static void main(String[] args) { // ColorE color=ColorE.BLUE; // System.out.println(color)... 阅读全文
posted @ 2014-09-03 10:47 塔斯曼 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 系统内建的Annotation: @Override:覆写的Annotation,方法覆写时使用,用于保证方法覆写的正确性。 @Deprecated:不赞成使用的Annotation,用来声明一个不建议使用的方法。 @SuppressWarning:压制安全警告的Annotation。 自定义: public @interface MyDefaultAnnotationValue ... 阅读全文
posted @ 2014-09-03 10:07 塔斯曼 阅读(111) 评论(0) 推荐(0) 编辑