Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Java Reflection

 
·´ÉäÊÇJavaÓïÑÔÖкÜÖØÒªµÄÒ»¸ö×é³É²¿·Ö£¬ËùÒԾʹ˻°ÌâÌÖÂÛµÄ×ÊÔ´¿ÉνÊýÖ®²»¾¡£¬ÈÕ³£¿ª·¢Ò²»á¾­³£Ê¹Óõ½¹ØÓÚ·´ÉäµÄReflection
API¡£Java5.0
Tiger³öÏÖÒԺ󣬸ü¶Ô·´ÉäAPIÓÐÁËеÄÀ©Õ¹£¬¾¡¹ÜÌÖÂ۵ϰÌâºÜ¶à£¬²»¹ýÎÒ»¹ÊǾõµÃ²»¹»È«Ã棬ÓÈÆäÊǶԷºÐÍÕâÒ»¿é£¬ËùÒÔ¾ÍÎÒËùÖª£¬ÔÙ»¨Á¦Æø×ܽáÒ»·¬
Ê×ÏÈ·´ÉäµÄÈë¿ÚÊÇ´ÓClass¿ªÊ¼µÄ£¬ËùÒÔÈçºÎ»ñÈ¡Class¾Í±äµÃÊ®·Ö¹Ø¼üÁË¡£ÕâÀï×ܽáÁ˼¸ÖÖ·½Ê½£º
1.ͨ¹ý${name}.class Óï·¨¡£ÕâÀï${name}¿ÉÒÔÊǶÔÏó£¬Ò²¿ÉÒÔÊÇԭʼÊý¾ÝÀàÐÍ£¬²»¹ý±ðÍüÁËvoid.classºÍVoid.class
2.ͨ¹ý${name}.TYPE Óï·¨¡£ÕâÀï${name}ÊǰËÖÖԭʼÊý¾ÝµÄ°ü×°ÀàºÍVoid.TYPE
3.ͨ¹ý¶ÔÏóµÄgetClass()·½·¨¡£
4.ͨ¹ýClass¶ÔÏóµÄforName()·½·¨
5.ͨ¹ýÀàClassµÄgetSuperclass()»ñÈ¡¸¸Ç×ÀàClass
6.ͨ¹ýÀàClassµÄgetEnclosingClass()»ñÈ¡ÍⲿÀàClass
7.ͨ¹ýÀàClassµÄgetClasses()ºÍgetDeclaredClasses()»ñÈ¡ÄÚ²¿ÀàClass
ÏÂÃæÊÇÒ»ÕűíÓÃÀ´ËµÃ÷getClasses()ºÍgetDeclaredClasses()Á½¸ö·½·¨£¬ÉÔºó»¹»áÓøñí˵Ã÷ÆäËûReflection API
--------------------------------------------------------------------------------------------
Member
      | Class API
                          | Return type
| Inherited members
| Private members
--------------------------------------------------------------------------------------------
Class            | getDeclaredClasses()         | Array    | N        | Y
                   
| getClasses()                       | Array   | Y          | N
--------------------------------------------------------------------------------------------
Field             | getDeclaredField()     &


Ïà¹ØÎĵµ£º

ÅÐ¶Ï Java ÖеĿÕ×Ö·û´®


ÒÔÏÂÊÇ Java ÅжÏ×Ö·û´®ÊÇ·ñΪ¿ÕµÄÈýÖÖ·½·¨.
·½·¨Ò»: ×î¶àÈËʹÓõÄÒ»¸ö·½·¨, Ö±¹Û, ·½±ã, µ«Ð§ÂʺܵÍ.
·½·¨¶þ: ±È½Ï×Ö·û´®³¤¶È, ЧÂʸß, ÊÇÎÒÖªµÀµÄ×îºÃÒ»¸ö·½·¨.
·½·¨Èý: Java SE 6.0 ²Å¿ªÊ¼ÌṩµÄ·½·¨, ЧÂʺͷ½·¨¶þ¼¸ºõÏàµÈ, µ«³öÓÚ¼æÈÝÐÔ¿¼ÂÇ, ÍÆ¼öʹÓ÷½·¨¶þ.
ÒÔÏ´úÂëÔÚÎÒ»úÆ÷ÉϵÄÔËÐнá¹û: (»úÆ÷ÐÔÄܲ»Ò», ½ö¹ ......

java»ñÈ¡µ±Ç°Â·¾¶

java»ñÈ¡µ±Ç°Â·¾¶
 
1¡¢ÀûÓÃSystem.getProperty()º¯Êý»ñÈ¡µ±Ç°Â·¾¶£º
System.out.println(System.getProperty("user.dir"));//user.dirÖ¸¶¨Á˵±Ç°µÄ·¾¶
2¡¢Ê¹ÓÃFileÌṩµÄº¯Êý»ñÈ¡µ±Ç°Â·¾¶£º
File directory = new File("");//É趨Ϊµ±Ç°Îļþ¼Ð
try{
    System.out.println(directory.getCano ......

javaÐĵã¡

 javaÐĵã¡--ºÜºÃµÄjavaѧϰÀú³Ì£¨×ª×ÔÕŹú±¦£© ÊÕ²Ø ´ËÎÄÓÚ2009-10-26±»ÍƼöµ½CSDNÊ×Ò³
ÈçºÎ±»ÍƼö£¿
1.    Êý×éÓÐûÓÐlength()Õâ¸ö·½·¨? StringÓÐûÓÐlength()Õâ¸ö·½·¨£¿
        ´ð£ºÊý×éûÓÐlength()Õâ¸ö·½·¨£¬ÓÐlengthµÄÊôÐÔ¡£
     ......

Javaµ÷ÓÃOracleÊý¾Ý¿âµÄ·ÖÒ³´æ´¢¹ý³Ì

 ×î½üÏîÄ¿½ø¶È±È½Ï»ºÂý£¬³õ²½Ñо¿ÁËÒ»ÏÂOracleµÄ´æ´¢¹ý³Ì£¬½«´úÂëÌù³öÀ´¡£
 Ê×ÏÈÏÈÌù³öÀ´OracleµÄ·ÖÒ³·ÖÒ³´æ´¢¹ý³Ì´úÂë°É¡£
 1.ÕâÊǰüµÄ´úÂë
 create or replace package DB_Oper is
  -- Author  : LIUBING
  -- Created : 2009-10-28 15:01:30
  -- Purpose : ²âÊÔOracleµ ......

javaËæ»úÊýµÄ²úÉú

1. import java.util.*; 
2.(A) public class Test
       { public static void main(String[] args)
         { 
         //Éú³É [0-n) ¸ö²»Öظ´µÄËæ»úÊý  st ÓÃÀ´±£´æ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ