Xiaobo Sun

          Eclipse-Unix http://umlfact.berlios.de/~s_xsun/

          Java Reflection

          Purpose: use the Instances of the class java.lang.Class to represent classes and interfaces in a running Java application.

          1. create Object:

          A a = (A)Class.forName("A").newInstance(); //If A isn't a correct Class Name, it's a Runtime-Exception "ClassForName", comparing to the Compile-Exception from "new A()"

          2. get Attributes/Methods information at Runtime:

          Class c = Class.forName(args[0]);
          Method m[] = c.getDeclaredMethods();

          posted on 2007-06-12 13:14 Xiaobo Sun 閱讀(222) 評論(0)  編輯  收藏 所屬分類: Java

          <2007年6月>
          272829303112
          3456789
          10111213141516
          17181920212223
          24252627282930
          1234567

          導航

          統計

          常用鏈接

          留言簿(3)

          隨筆分類

          隨筆檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 刚察县| 札达县| 寿光市| 山丹县| 张掖市| 长沙市| 营口市| 兴宁市| 高台县| 盐山县| 龙山县| 吉木萨尔县| 望江县| 肇庆市| 德兴市| 松江区| 铜陵市| 循化| 当涂县| 阿拉善左旗| 桦川县| 乌苏市| 靖远县| 龙州县| 勃利县| 桑日县| 嘉兴市| 陇川县| 万载县| 同心县| 土默特左旗| 高邑县| 汉川市| 区。| 阿尔山市| 秭归县| 丁青县| 伊宁县| 太保市| 天祝| 景东|