Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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 throw error

Òì³£
Òì³£´æÔÚµÄÄ¿µÄ
¿´Ò»ÏÂCÓïÑԵijö´í´¦Àí·½Ê½
int f() {
    f1();
    f2():
    f3();
}//Èç¹ûÔÚÿ¸öº¯Êýºó¶¼Ôö¼Ó³ö´íµÄÅжÏ(Èç¹ûÊÇÕý³£Âß¼­¿ÉÒÔ×ß²»Í¬µÄ·ÖÖ§)²¢ÊÍ·Å×ÊÔ´£¬ÄÇÕâ¸öº¯ÊýÄÚ»áÓÐÌ«¶àÓëÖ÷¸ÉÎÞ¹ØÓ°ÏìÇåÎúÔĶÁµÄ´úÂë´æÔÚ£¬¶øÇÒ¹ý¶àreturnÓÐʱ»áʹµÃ×ÊÔ´µ ......

¼´½«ÉýÈëJAVA¾«Æ·¾ÍÒµ°à

2009ÄêµÄ12ÔÂ22ÈÕ£¬ÎÒ´Ó¹«Ë¾´ÇÖ°ÁË£¬ÒòΪûÓз¢Õ¹Ç°Í¾£¬2009Äê12ÔÂ24ÈÕ£¬ÎÒÀ´µ½ÁË´«ÖDz¥¿ÍÉÏJAVAµÄÔ¤ÈȰ࣬ÕâÆÚ°àÊǸöºÍÉа࣬ûÓÐÒ»¸öÅ®Éú£¬¸Ð¾õÆø·Õ»¹²»´í£¬Ã¿Ìì´ó¼Ò¶¼ÔÚÒ»Æðѧϰ£¬¸ú×ÅÀÏÐìÉϿΣ¬Ï¿ÎÊǸçÃÇ£¬Ò»Æð³é³éÑÌ£¬ÁÄÁÄJAVA£¬¾ÍÕâÑùÒ»¸ö°ëÔµÄÔ¤ÈȰà¾Í½áÊøÁË¡£
¸ÐлÐìÀÏʦµÄ½Ìµ¼£¬¸Ðл°àÀïµÄ¸÷λͬѧµÄ°ïÖú£¬¹þ¹þ ......

JAVA ÖÐURLÁ´½ÓÖÐÎIJÎÊýÂÒÂëµÄ´¦Àí·½·¨

JAVA ÖÐURLÁ´½ÓÖÐÎIJÎÊýÂÒÂëµÄÈô¸É´¦Àí·½·¨£¬ÏÖÔÚÕûÀíÊÕ¼ÈçÏÂ:
·½·¨Ò»£º
http://xxx.do?ptname='ÎÒÊÇÖйúÈË'
String strPtname = request.getParameter("ptname");
strPtname = new String(strPtname.getBytes("ISO-8859-1"), "UTF-8");  
·½·¨¶þ£º
<%@ page contentTy ......

¼òµ¥µÄjavaͼÏñ²Ã¼õ

/**
* ¶ÔͼƬ²Ã¼ô£¬²¢°Ñ²Ã¼ôÍêµ°ÐÂͼƬ±£´æ ¡£
*
* @param srcpath: ±»²Ã¼õµÄͼƬÍêÕû·¾¶
* @param tarpath: ÒѲüõµÄÐÂͼƬ±£´æÍêÕûµÄ·¾¶
* @param x: ²Ã¼õ¾ØÐÎÇøÓò×óÉ϶¥µãË®Æ½Î»ÒÆ
* @param y: ²Ã¼õ¾ØÐÎÇøÓò×óÉ϶¥µã´¹Ö±Î»ÒÆ
* @param width: ²Ã¼õ¾ØÐÎÇøÓòµÄ¿í¶È
* @param height: ²Ã¼õ¾ØÐÎ ......

16Ììѧ»áJava £¨ºÜ²»´íµÄÎÄÕ£¬ÍƼö£©

Day 01
Ò»¡¢    ´ÓÃæÏò¹ý³Ì±à³Ìµ½ÃæÏò¶ÔÏó±à³ÌµÄ˼άת±ä
ÎÒÃÇÖªµÀËùÓеļÆËã»ú³ÌÐò¶¼ÊÇÓÉÁ½ÀàÔªËØ×é³É£º´úÂëºÍÊý¾Ý¡£´ËÍâ´Ó¸ÅÄîÉϽ«½²£¬³ÌÐò»¹¿ÉÒÔÒÔËûµÄ´úÂë»òÊÇÊý¾ÝΪºËÐĽøÐÐ×éÖ¯±àд¡£Ò²¾ÍÊÇ˵һЩ³ÌÐòÎ§ÈÆ“ÕýÔÚ·¢Éúʲô±àд“£¬¶øÁíһЩ³ÌÐòÔòÎ§ÈÆ”Ë­½«±»Ó°Ï쓱àд¡£ÕâÁ½ÖÖ· ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ