¿ìËÙÒµÎñͨµÀ

Java¿ª·¢ÕßÐè¼áÊصÄÊ®´ó»ù±¾×¼Ôò - ±à³ÌÈëÃÅÍø

×÷Õß ØýÃû¼¼Êõ À´Ô´ NET±à³Ì ä¯ÀÀ ·¢²¼Ê±¼ä 2012-06-19
Ê¡µãÁ¦Æø°É£¬»ØÍ·¿´¿´µÚ¶þÌõ——²»ÒªÈÃÊÂÇ鸴ÔÓ»¯¡£ÁíÍ⣬Èç¹ûÕýÔÚ¿ª·¢µÄ³ÌÐòÖ»ÓÐ3¸ö´°¿Ú£¬¾Í²»ÒªÊ¹ÓÃStrutsÁË£¬¶ÔÕâÖÖ³ÌÐòÀ´Ëµ£¬²»ÐèÒªÄÇô¶àµÄ“¿ØÖÆ”¡£

Áù¡¢²»ÒªÊ¹ÓÃprintln¼°×Ö·û´®Á¬½Ó¡£Í¨³£ÎªÁ˵÷ÊÔ·½±ã£¬¿ª·¢Õßϲ»¶ÔÚ¿ÉÄܵÄËùÓеط½¶¼¼ÓÉÏSystem.out.println£¬Ò²Ðí»¹»áÌáÐÑ×Ô¼º»Ø¹ýÍ·À´ÔÙÀ´É¾³ý£¬µ«ÓÐЩʱºò£¬¾­³£»áÍüÁËɾ³ý»òÕß²»Ô¸Òâɾ³ýËüÃÇ¡£¼ÈȻʹÓÃSystem.out.printlnÊÇΪÁ˲âÊÔ£¬ÄÇô²âÊÔÍêÖ®ºó£¬ÎªÊ²Ã´»¹ÒªÁô×ÅËüÃÇÄØ£¬ÒòΪÔÚɾ³ýʱ£¬ºÜ¿ÉÄÜ»áɾ³ýµôÕæÕýÓÐÓõĴúÂ룬ËùÒÔ²»Äܵ͹ÀSystem.out.printlnΣº¦°¡£¬Çë¿´ÏÂÃæµÄ´úÂ룺

public class BadCode { public static void calculationWithPrint(){ double someValue = 0D; for (int i = 0; i £¼10000; i++) { System.out.println(someValue = someValue + i); } } public static void calculationWithOutPrint(){ double someValue = 0D; for (int i = 0; i £¼ 10000; i++) { someValue = someValue + i; } } public static void main(String [] n) { BadCode.calculationWithPrint(); BadCode.calculationWithOutPrint(); } }

´Ó²âÊÔÖпÉÒÔ·¢ÏÖ£¬·½·¨calculationWithOutPrint()Ö´ÐÐÓÃÁË0.001204Ã룬×÷Ϊ¶Ô±È£¬·½·¨calculationWithPrint()Ö´ÐпÉÊÇÓÃÁË10.52Ãë¡£

Òª±ÜÃâÀË·ÑCPUʱ¼ä£¬×îºÃµÄ·½·¨ÊÇÒýÈëÏñÈçϵİü×**½·¨£º

public class BadCode { public static final int DEBUG_MODE = 1; public static final int PRODUCTION_MODE = 2; public static void calculationWithPrint(int logMode){double someValue = 0D; for (int i = 0; i £¼ 10000; i++) { someValue = someValue + i; myPrintMethod(logMode, someValue); } } public static void myPrintMethod(int logMode, double value) { if (logMode £¾ BadCode.DEBUG_MODE) { return; } System.out.println(value); } public static void main(String [] n) { BadCode.calculationWithPrint(BadCode.PRODUCTION_MODE); } }

Java¿ª·¢ÕßÐè¼áÊصÄÊ®´ó»ù±¾×¼Ôò(3)

ʱ¼ä:2011-02-12 ÌƳ¯

ÁíÍ⣬×Ö·û´®Á¬½ÓÒ²ÊÇÀË·ÑCPUʱ¼äµÄÒ»¸ö´óÍ·£¬Çë¿´ÏÂÃæµÄʾÀý´úÂ룺

public static void concatenateStrings(String startingString) { for (int i = 0; i £¼ 20; i++) { startingString = startingString + startingString; } } public static void concatenateStringsUsingStringBuffer(String startingString) { StringBuffer sb = new StringBuffer(); for (int i = 0; i £¼ 20; i++) { sb.append(sb.toString()); } }

ÔÚ²âÊÔÖпɷ¢ÏÖ£¬Ê¹ÓÃStringBufferµÄ·½·¨Ö»ÓÃÁË0.01ÃëÖ´ÐÐÍê±Ï£¬¶øʹÓÃÁ¬½ÓµÄ·½·¨ÔòÓÃÁË0.08Ã룬ѡÔñÏÔ¶øÒ×¼ûÁË¡£

Æß¡¢¶à¹Ø×¢GUI£¨Óû§½çÃ棩¡£ÔÙÈýÇ¿µ÷£¬GUI¶ÔÉÌÒµ¿Í»§À´Ëµ£¬Óë³ÌÐòµÄ¹¦Äܼ°Ð§ÂÊͬµÈÖØÒª£¬GUIÊÇÒ»¸ö³É¹¦³ÌÐòµÄ×î»ù±¾²¿·Ö£¬¶øºÜ¶àIT¾­ÀíÍùÍù¶¼Ã»×¢Òâµ½GUIµÄÖØÒªÐÔ¡£ÔÚÏÖʵÉú»îÖУ¬Ðí¶à¹«Ë¾¿ÉÄÜΪÁ˽ÚÊ¡¿ªÖ§£¬Ã»ÓйÍÓÃÄÇЩÓÐ×ÅÉè¼Æ“Óû§ÓѺÔ½çÃæ·á¸»¾­ÑéµÄÍøÒ³Éè¼ÆÕߣ¬´ËʱJava¿ª·¢ÕßÖ»ÄÜÒÀÀµËûÃÇ×ÔÉíµÄHTML»ù±¾¹¦¼°ÔÚ´ËÁìÓòÓÐÏÞµÄ֪ʶ£¬½á¹û£¬ºÜ¶à¿ª·¢³öÀ´µÄ³ÌÐò¶¼ÊÇ“¼ÆËã»úÓѺÔÉõÓÚ“Óû§ÓѺÔ¡£ºÜÉÙÓпª·¢Õßͬʱ¾«Í¨Èí¼þ¿ª·¢¼°GUIÉè¼Æ£¬Èç¹ûÄãÔÚ¹«Ë¾“²»ÐÒ”±»·ÖÅ为Ôð³ÌÐò½çÃ棬¾ÍÓ¦¸Ã×ñÊØÏÂÃæÈýÌõÔ­Ôò£º

1¡¢²»ÒªÔÙ·¢Ã÷Ò»´ÎÂÖ×Ó£¬¼´²»×öÎÞÓù¦¡£ÏÖÓеijÌÐò¿ÉÄÜ»áÓÐÀàËƵĽçÃæÐèÇó¡£

2¡¢ÏÈ´´½¨Ò»¸öÔ­ÐÍ¡£ÕâÊǷdz£ÖØÒªÒ»²½£¬Óû§Ò»°ãÏë¿´µ½ËûÃǽ«Ê¹ÓõĶ«Î÷£¬¶øÇÒ¿ÉÒÔÏÈÀûÓÃÕâ¸öÔ­ÐÍÕ÷ÇóÓû§µÄÒâ¼û£¬ÔÙÂýÂýÐ޸ijÉÓû§ÏëÒªµÄÑù×Ó¡£

3¡¢Ñ§»á»»Î»Ë¼¿¼¡£»»¾ä»°À´Ëµ£¬¾ÍÊÇ´ÓÓû§µÄ½Ç¶ÈÀ´Éó²é³ÌÐòµÄÐè

ÁèÖڿƼ¼×¨ÒµÌṩ·þÎñÆ÷×âÓᢷþÎñÆ÷Íйܡ¢ÆóÒµÓʾ֡¢ÐéÄâÖ÷»úµÈ·þÎñ£¬¹«Ë¾ÍøÕ¾£ºhttp://www.lingzhong.cn ΪÁ˸ø¹ã´ó¿Í»§Á˽â¸ü¶àµÄ¼¼ÊõÐÅÏ¢£¬±¾¼¼ÊõÎÄÕÂÊÕ¼¯À´Ô´ÓÚÍøÂç,ÁèÖڿƼ¼×ðÖØÎÄÕÂ×÷ÕߵİæȨ£¬Èç¹ûÓÐÉæ¼°ÄãµÄ°æȨÓбØҪɾ³ýÄãµÄÎÄÕ£¬ÇëºÍÎÒÃÇÁªÏµ¡£ÒÔÉÏÐÅÏ¢ÓëÎÄÕÂÕýÎÄÊDz»¿É·Ö¸îµÄÒ»²¿·Ö,Èç¹ûÄúҪתÔر¾ÎÄÕÂ,Çë±£ÁôÒÔÉÏÐÅÏ¢£¬Ð»Ð»!

·ÖÏíµ½£º ¸ü¶à

Copyright ©1999-2011 ÏÃÃÅÁèÖڿƼ¼ÓÐÏÞ¹«Ë¾ ÏÃÃÅÓÅͨ»¥Áª¿Æ¼¼¿ª·¢ÓÐÏÞ¹«Ë¾ All rights reserved

µØÖ·(ADD)£ºÏÃÃÅÈí¼þÔ°¶þÆÚÍûº£Â·63ºÅ701E£¨¶«ÄÏÈÚͨÅÔ£© Óʱà(ZIP)£º361008

µç»°£º0592-5908028 ´«Õ棺0592-5908039 ×ÉѯÐÅÏ䣺web@lingzhong.cn ×ÉѯOICQ£º173723134

¡¶ÖлªÈËÃñ¹²ºÍ¹úÔöÖµµçÐÅÒµÎñ¾­ÓªÐí¿ÉÖ¤¡·ÃöB2-20100024  ICP±¸°¸:ÃöICP±¸05037997ºÅ