java·´Éä¾µäʵÀý
JavaÌṩÁËÒ»Ì×»úÖÆÀ´¶¯Ì¬Ö´Ðз½·¨ºÍ¹¹Ôì·½·¨£¬ÒÔ¼°Êý×é²Ù×÷µÈ£¬ÕâÌ×»úÖƾͽЗ—·´Éä¡£·´Éä»úÖÆÊÇÈç½ñºÜ¶àÁ÷Ðпò¼ÜµÄʵÏÖ»ù´¡£¬ÆäÖаüÀ¨Spring¡¢HibernateµÈ¡£ÔÀíÐÔµÄÎÊÌâ²»ÊDZ¾ÎĵÄÖص㣬½ÓÏÂÀ´ÈÃÎÒÃÇÔÚʵÀýÖÐѧϰÕâÌ×¾«²ÊµÄ»úÖÆ¡£
1. µÃµ½Ä³¸ö¶ÔÏóµÄÊôÐÔ
public Object getProperty(Object owner, String fieldName) throws Exception {
Class ownerClass = owner.getClass();
Field field = ownerClass.getField(fieldName);
Object property = field.get(owner);
return property;
}
Class ownerClass = owner.getClass()£ºµÃµ½¸Ã¶ÔÏóµÄClass¡£
Field field = ownerClass.getField(fieldName)£ºÍ¨¹ýClassµÃµ½ÀàÉùÃ÷µÄÊôÐÔ¡£
Object property = field.get(owner)£ºÍ¨¹ý¶ÔÏóµÃµ½¸ÃÊôÐÔµÄʵÀý£¬Èç¹ûÕâ¸öÊôÐÔÊǷǹ«Óеģ¬ÕâÀï»á±¨IllegalAccessException¡£
2. µÃµ½Ä³¸öÀàµÄ¾²Ì¬ÊôÐÔ
public Object getStaticProperty(String className, String fieldName)
throws Exception {
Class ownerClass = Class.forName(className);
Field field = ownerClass.getField(fieldName);
Object property = field.get(ownerClass);
return property;
}
Class ownerClass = Class.forName(className) £ºÊ×Ïȵõ½Õâ¸öÀàµÄClass¡£
Field field = ownerClass.getField(fiel
Ïà¹ØÎĵµ£º
Java¶àÏ̱߳à³Ì×ܽá
ÏÂÃæÊÇJavaÏß³ÌϵÁв©ÎĵÄÒ»¸ö±àÄ¿£º
JavaỊ̈߳º¸ÅÄîÓëÔÀí
JavaỊ̈߳º´´½¨ÓëÆô¶¯
JavaỊ̈߳ºÏß³ÌջģÐÍÓëÏ̵߳ıäÁ¿
JavaỊ̈߳ºÏß³Ì״̬µÄת»»
JavaỊ̈߳ºÏ̵߳Äͬ²½ÓëËø
JavaỊ̈߳ºÏ̵߳Ľ»»¥
JavaỊ̈߳ºÏ̵߳ĵ÷¶È-ÐÝÃß
JavaỊ̈߳ºÏ̵߳ĵ÷¶È-ÓÅÏȼ¶
JavaỊ̈߳ºÏß ......
Ò»¡¢ÈÏʶ¶àÈÎÎñ¡¢¶à½ø³Ì¡¢µ¥Ï̡߳¢¶àÏß³Ì
ÒªÈÏʶ¶àÏ߳̾ÍÒª´Ó²Ù×÷ϵͳµÄÔÀí˵Æð¡£
ÒÔÇ°¹ÅÀϵÄDOS²Ù×÷ϵͳ£¨V 6.22£©Êǵ¥ÈÎÎñµÄ£¬»¹Ã»ÓÐÏ̵߳ĸÅÄϵͳÔÚÿ´ÎÖ»ÄÜ×öÒ»¼þÊÂÇé¡£±ÈÈçÄãÔÚcopy¶«Î÷µÄʱºò²»ÄÜrenameÎļþÃû¡£ÎªÁËÌá¸ßϵͳµÄÀûÓÃЧÂÊ£¬²ÉÓÃÅú´¦ÀíÀ´ÅúÁ¿Ö´ÐÐÈÎÎñ¡£
ÏÖÔڵIJÙ×÷ϵͳ¶¼ÊǶàÈÎÎñ² ......
JavaỊ̈߳º´´½¨ÓëÆô¶¯
SCJP5ѧϰ±Ê¼Ç
Ò»¡¢¶¨ÒåÏß³Ì
1¡¢À©Õ¹java.lang.ThreadÀà¡£
´ËÀàÖÐÓиörun()·½·¨£¬Ó¦¸Ã×¢ÒâÆäÓ÷¨£º
public void run()
Èç¹û¸ÃÏß³ÌÊÇʹÓöÀÁ¢µÄ Runnable ÔËÐжÔÏó¹¹ÔìµÄ£¬Ôòµ÷Óøà Runnable ¶ÔÏóµÄ run ·½·¨£»·ñÔò£¬¸Ã·½·¨²»Ö´ÐÐÈκβÙ×÷²¢·µ»Ø¡£
T ......
Ãô½Ý¿ª·¢µÄÀíÄîÒѾÁ÷ÐÐÁ˺ܳ¤µÄʱ¼ä£¬ÔÚÃô½Ý¿ª·¢ÖеĿª·¢µü´ú½×¶ÎÖУ¬ÎÒÃÇ¿ÉÒÔͨ¹ýÎå¸ö²½Ö裬À´ÓÐЧµÄÌá¸ßÕû¸öÏîÄ¿µÄ´úÂëÖÊÁ¿¡£
JavaÏîÄ¿¿ª·¢¹ý³ÌÖУ¬ÓÉÓÚ¿ª·¢ÈËÔ±µÄ¾Ñé¡¢Java´úÂë±àдϰ¹ß£¬ÒÔ¼°È±·¦Í³Ò»µÄ±ê×¼ºÍ¹ÜÀíÁ÷³Ì£¬ÍùÍùµ¼ÖÂÕû¸öÏîÄ¿µÄ´úÂëÖÊÁ¿½Ï²î£¬ÄÑÓÚά »¤£¬ÐèÒª½Ï´óµÄ²âÊÔͶÈëºÍÖÜÆÚµÈÎÊÌâ¡£ÕâЩÎÊÌâÔÚÒ»¸öÏ ......