]]>Java閲屽皢鏁扮粍杞寲涓篖isthttp://www.tkk7.com/oceanqtt/archive/2005/10/14/15471.html铇戣弴铇戣弴Fri, 14 Oct 2005 00:35:00 GMThttp://www.tkk7.com/oceanqtt/archive/2005/10/14/15471.htmlhttp://www.tkk7.com/oceanqtt/comments/15471.htmlhttp://www.tkk7.com/oceanqtt/archive/2005/10/14/15471.html#Feedback0http://www.tkk7.com/oceanqtt/comments/commentRss/15471.htmlhttp://www.tkk7.com/oceanqtt/services/trackbacks/15471.htmlObject[] objs = new Objects[10];
]]>濡備綍鏇存敼縐佹湁鎴愬憳錛?/title>http://www.tkk7.com/oceanqtt/archive/2005/09/26/14087.html铇戣弴铇戣弴Mon, 26 Sep 2005 04:19:00 GMThttp://www.tkk7.com/oceanqtt/archive/2005/09/26/14087.htmlhttp://www.tkk7.com/oceanqtt/comments/14087.htmlhttp://www.tkk7.com/oceanqtt/archive/2005/09/26/14087.html#Feedback3http://www.tkk7.com/oceanqtt/comments/commentRss/14087.htmlhttp://www.tkk7.com/oceanqtt/services/trackbacks/14087.html鍋囪綾籗ummer瀹氫箟濡備笅錛?BR>public class Summer{ private int number = 0; }
嫻嬭瘯濡備笅錛?BR>Summer example = new Summer.newInstance(); Field f = example .getClass().getDeclaredField("number"); f.setAccessible(true); f.set(example, 2); f.setAccessible(false);
public void CheckIP(String IP){ int i; int index; String cur; //鍒ゆ柇鏄惁瀛樺湪闈濱P瀛楃 for (i = 0;i < IP.length();i++){ if (IPComp.indexOf(IP.charAt(i)) == -1){ throw new yourException(yourErrorString); } } //鍙樻崲IP涓?xxx.'閲嶅鐨勬牸寮?BR> IP = IP + "."; //鍒嗗埆鑾峰緱鍓嶅洓涓?xxx.'媯鏌?BR> for (i = 1;i <= 4;i++){ //鍒ゆ柇搴昳涓?xxx.'鏄惁瀛樺湪錛坕<=4錛?BR> index = IP.indexOf('.'); if (index == -1){ throw new yourException(yourErrorString); } else{ //鑾峰緱鏁板瓧錛屾鏌ユ暟瀛楄寖鍥?BR> cur = IP.substring(0,index); IP = IP.substring(index + 1); if (cur.length() > 0 && cur.length() <= 3){ //change cur to int int num = 0; for (index = 0;index < cur.length();index++){ num = num * 10 + (int)cur.charAt(index) - 48; } if (num > 255){ throw new yourException(yourErrorString); } } else{ throw new yourException(yourErrorString); } } } //媯鏌ユ槸鍚︽湁澶氱殑'xxx.' if (IP.indexOf('.') != -1){ throw new yourException(yourErrorString); } }