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

JAVAÖеķ´Éä»úÖÆÏê½â

JAVA·´Éä»úÖÆ
    JAVA·´Éä»úÖÆÊÇÔÚÔËÐÐ״̬ÖУ¬¶ÔÓÚÈÎÒâÒ»¸öÀ࣬¶¼Äܹ»ÖªµÀÕâ¸öÀàµÄËùÓÐÊôÐԺͷ½·¨£»¶ÔÓÚÈÎÒâÒ»¸ö¶ÔÏ󣬶¼Äܹ»µ÷ÓÃËüµÄÈÎÒâÒ»¸ö·½·¨£»ÕâÖÖ¶¯Ì¬»ñÈ¡µÄÐÅÏ¢ÒÔ¼°¶¯Ì¬µ÷ÓöÔÏóµÄ·½·¨µÄ¹¦ÄܳÆΪjavaÓïÑԵķ´Éä»úÖÆ¡£
Java·´Éä»úÖÆÖ÷ÒªÌṩÁËÒÔϹ¦ÄÜ£º ÔÚÔËÐÐʱÅжÏÈÎÒâÒ»¸ö¶ÔÏóËùÊôµÄÀࣻÔÚÔËÐÐʱ¹¹ÔìÈÎÒâÒ»¸öÀàµÄ¶ÔÏó£»ÔÚÔËÐÐʱÅжÏÈÎÒâÒ»¸öÀàËù¾ßÓеijÉÔ±±äÁ¿ºÍ·½·¨£»ÔÚÔËÐÐʱµ÷ÓÃÈÎÒâÒ»¸ö¶ÔÏóµÄ·½·¨£»Éú³É¶¯Ì¬´úÀí¡£
1. µÃµ½Ä³¸ö¶ÔÏóµÄÊôÐÔ
1 public Object getProperty(Object owner, String fieldName) throws Exception {
2     Class ownerClass = owner.getClass();

4     Field field = ownerClass.getField(fieldName);

6     Object property = field.get(owner);

8     return property;
9 }
Class ownerClass = owner.getClass()£ºµÃµ½¸Ã¶ÔÏóµÄClass¡£
Field field = ownerClass.getField(fieldName)£ºÍ¨¹ýClassµÃµ½ÀàÉùÃ÷µÄÊôÐÔ¡£
Object property = field.get(owner)£ºÍ¨¹ý¶ÔÏóµÃµ½¸ÃÊôÐÔµÄʵÀý£¬Èç¹ûÕâ¸öÊôÐÔÊǷǹ«Óеģ¬ÕâÀï»á±¨IllegalAccessException¡£
2. µÃµ½Ä³¸öÀàµÄ¾²Ì¬ÊôÐÔ
 1 public Object getStaticProperty(String className, String fieldName)
 2             throws Exception {
 3     Class ownerClass = Class.forName(className);
 4 
 5     Field field = ownerClass.getField(fieldName);
 6 
 7     Object property = field.get(ownerClass);
 8 
 9     return property;
10 }
Class ownerClass = Class.forName(className) £ºÊ×Ïȵõ½Õâ¸öÀàµÄClass¡£
Field field&n


Ïà¹ØÎĵµ£º

ÊÕ¼¯µ½µÄjava ÕýÔòÑéÖ¤ Ô´Âë


import java.util.regex.*;   
  
public final class RegExpValidator   
{   
    /**  
     * ÑéÖ¤ÓÊÏä  
     * @param ´ýÑéÖ¤µÄ×Ö·û´®   ......

java byteÓëchar»¥×ªÔ­Àí ת

java byteÓëchar»¥×ªÔ­Àí-ת
Ò»¡¢×Ö½ÚºÍunicode
JavaÄÚºËÊÇunicodeµÄ£¬¾ÍÁ¬classÎļþÒ²ÊÇ£¬µ«ÊǺܶàýÌ壬°üÀ¨Îļþ/Á÷µÄ±£´æ·½Ê½ÊÇʹÓÃ×Ö½ÚÁ÷µÄ¡£Òò´ËJavaÒª¶ÔÕâЩ×Ö½ÚÁ÷¾­ÐÐת»¯¡£ charÊÇunicodeµÄ£¬¶øbyteÊÇ×Ö½Ú¡£JavaÖÐ byte/char»¥×ªµÄº¯ÊýÔÚsun.ioµÄ°üÖмäÓС£ÆäÖÐByteToCharConverterÀàÊÇÖе÷¶È£¬¿ÉÒÔÓÃÀ´¸æËßÄ㣬 ......

java IO³õ²½

ʲôÊÇÁ÷£º
Á÷ÊÇÒ»¸ö³éÏóµÄ¸ÅÄî¡£µ±Java³ÌÐòÐèÒª´ÓÊý¾ÝÔ´¶ÁÈ¡Êý¾Ýʱ£¬»á¿ªÆôÒ»¸öµ½Êý¾ÝÔ´µÄÁ÷¡£Êý¾ÝÔ´¿ÉÒÔÊÇÎļþ£¬ÄÚ´æ»òÕßÍøÂçµÈ¡£Í¬Ñù£¬µ±³ÌÐòÐèÒªÊä³öÊý¾Ýµ½Ä¿µÄµØʱҲһÑù»á¿ªÆôÒ»¸öÁ÷£¬Êý¾ÝÄ¿µÄµØÒ²¿ÉÒÔÊÇÎļþ¡¢ÄÚ´æ»òÕßÍøÂçµÈ¡£Á÷µÄ´´½¨ÊÇΪÁ˸ü·½±ãµØ´¦ÀíÊý¾ÝµÄÊäÈëÊä³ö¡£
Á÷·ÖΪ×Ö½ÚÁ÷ºÍ×Ö·ûÁ÷¡£×Ö½ÚÁ÷Ò²³ÆÎªÔ­Ê ......

JavaÖеķÃÎÊȨÏÞ¿ØÖÆ

JavaÖеķÃÎÊȨÏÞ¿ØÖÆ·ûÓÐËĸö.
×÷ÓÃÓò_____µ±Ç°Àà____ͬһpackage___×ÓËïÀà____ÆäËûpackage
public______√___________√__________√___________√
protected___√___________√__________√___________×
friendly_____√___________√__________×________ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ