![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
反射
旧城以西林
这个作者很懒,什么都没留下…
展开
-
反射之属性操作
所使用的实体类: package reflect; //定义一个学生类,作为测试项 public class Student { private String id; public int age; String phone; //无参构造方法 public Student(){} //全参构造方法 public Student(String原创 2017-12-30 16:02:01 · 186 阅读 · 0 评论 -
反射之方法
所用实体类: package reflect; //定义一个学生类,作为测试项 public class Student { private String id; public int age; String phone; //无参构造方法 public Student(){} //全参构造方法 public Student(String id, int age, Str原创 2017-12-30 16:35:57 · 162 阅读 · 0 评论 -
反射之构造器
所用实体类: package reflect; //定义一个学生类,作为测试项 public class Student { private String id; public int age; String phone; //无参构造方法 public Student(){} //全参构造方法 public Student(String id, int age, Str原创 2017-12-30 16:19:17 · 235 阅读 · 0 评论 -
反射之获取类运行时对象方法
// 获取类运行时对象方法一 Class student = Student.class; // 方法二 //注意此处吃的名字其实是一个字符串,但这个字符串必须是目标类的全路径:包名+类名 Class studnet1 = Class.forName("day31reflect.Student"); // 方法三,调用Object的方法 Student s = new Student(); Cl原创 2017-12-30 16:00:37 · 823 阅读 · 0 评论