2014-04-26 19:06
题目:Java中的对象反射机制是什么?有鼠么用?
解法:完全不了解,因为java编程经验太少,完全没用过。查了一些资料后,感觉反射机制是个强大并需要边用边体会的强大工具。能灵活处理各种动态类型下的问题。
代码:
1 // 14.5 Tell me something about Object Reflection in java. 2 // Answer: 3 // 1. class type, constructor, member method, these are a few characteristics of a class 4 // 2. the Object Reflection is a collection of tool classes, it is able to handle the situation when you know you want certain behavior, but don't know exactly what type of class you need. 5 // 3. Unlike generics, it mainly deal with member methods and constructors, while generics focus more about data. 6 // 4. you may get a specific constructor, a member method with customized constraints. 7 public class TestJava { 8 public static void main(String[] args) { 9 return; 10 } 11 }