תÌù: JavaµÄÀ¬»ø»ØÊÕ»úÖÆ
2006-01-18 13:53×÷Õߣº³ö´¦£º²©¿ÍÔ°ÔðÈα༣º·½ÖÛ http://dev.yesky.com/178/2278678.shtml ÒýÑÔ
JavaµÄ¶ÑÊÇÒ»¸öÔËÐÐʱÊý¾ÝÇø£¬ÀàµÄʵÀý(¶ÔÏó)´ÓÖзÖÅä¿Õ¼ä¡£JavaÐéÄâ»ú(JVM)µÄ¶ÑÖд¢´æ×ÅÕýÔÚÔËÐеÄÓ¦ÓóÌÐòËù½¨Á¢µÄËùÓжÔÏó£¬ÕâЩ¶ÔÏóͨ¹ýnew¡¢newarray¡¢anewarrayºÍmultianewarrayµÈÖ¸ÁÁ¢£¬µ«ÊÇËüÃDz»ÐèÒª³ÌÐò´úÂëÀ´ÏÔʽµØÊÍ·Å¡£Ò»°ãÀ´Ëµ£¬¶ÑµÄÊÇÓÉÀ¬»ø»ØÊÕ À´¸ºÔðµÄ£¬¾¡¹ÜJVM¹æ·¶²¢²»ÒªÇóÌØÊâµÄÀ¬»ø»ØÊÕ¼¼Êõ£¬ÉõÖÁ¸ù±¾¾Í²»ÐèÒªÀ¬»ø»ØÊÕ£¬µ«ÊÇÓÉÓÚÄÚ´æµÄÓÐÏÞÐÔ£¬JVMÔÚʵÏÖµÄʱºò¶¼ÓÐÒ»¸öÓÉÀ¬»ø»ØÊÕËù¹ÜÀíµÄ¶Ñ¡£À¬»ø»ØÊÕÊÇÒ»ÖÖ¶¯Ì¬´æ´¢¹ÜÀí¼¼Êõ£¬Ëü×Ô¶¯µØÊͷŲ»ÔÙ±»³ÌÐòÒýÓõĶÔÏ󣬰´ÕÕÌØ¶¨µÄÀ¬»øÊÕ¼¯Ëã·¨À´ÊµÏÖ×ÊÔ´×Ô¶¯»ØÊյŦÄÜ¡£
À¬»øÊÕ¼¯µÄÒâÒå
ÔÚC++ÖУ¬¶ÔÏóËùÕ¼µÄÄÚ´æÔÚ³ÌÐò½áÊøÔËÐÐ֮ǰһֱ±»Õ¼Óã¬ÔÚÃ÷È·ÊÍ·Å֮ǰ²»ÄÜ·ÖÅ䏸ÆäËü¶ÔÏó£»¶øÔÚJavaÖУ¬µ±Ã»ÓжÔÏóÒýÓÃÖ¸ÏòÔÏÈ·ÖÅ䏸ij¸ö¶ÔÏóµÄÄÚ´æÊ±£¬¸ÃÄÚ´æ±ã³ÉΪÀ¬»ø¡£JVMµÄÒ»¸öϵͳ¼¶Ï̻߳á×Ô¶¯ÊͷŸÃÄÚ´æ¿é¡£À¬»øÊÕ¼¯Òâζ×ųÌÐò²»ÔÙÐèÒªµÄ¶ÔÏóÊÇ"ÎÞÓÃÐÅÏ¢"£¬ÕâЩÐÅÏ¢½«±»¶ªÆú¡£µ±Ò»¸ö¶ÔÏó²»ÔÙ±»ÒýÓõÄʱºò£¬ÄÚ´æ»ØÊÕËüÕ¼ÁìµÄ¿Õ¼ä£¬ÒÔ±ã¿Õ¼ä±»ºóÀ´µÄжÔÏóʹÓá£ÊÂʵÉÏ£¬³ýÁËÊÍ·ÅûÓõĶÔÏó£¬À¬»øÊÕ¼¯Ò²¿ÉÒÔÇå³ýÄÚ´æ¼Ç¼Ë鯬¡£ÓÉÓÚ´´½¨¶ÔÏóºÍÀ¬»øÊÕ¼¯Æ÷ÊͷŶªÆú¶ÔÏóËùÕ¼µÄÄÚ´æ¿Õ¼ä£¬ÄÚ´æ»á³öÏÖË鯬¡£Ë鯬ÊÇ·ÖÅ䏸¶ÔÏóµÄÄÚ´æ¿éÖ®¼äµÄ¿ÕÏÐÄÚ´æ¶´¡£Ë鯬ÕûÀí½«ËùÕ¼ÓõĶÑÄÚ´æÒƵ½¶ÑµÄÒ»¶Ë£¬JVM½«ÕûÀí³öµÄÄÚ´æ·ÖÅ䏸еĶÔÏó¡£
À¬»øÊÕ¼¯ÄÜ×Ô¶¯ÊÍ·ÅÄÚ´æ¿Õ¼ä£¬¼õÇá±à³ÌµÄ¸ºµ£¡£ÕâʹJava ÐéÄâ»ú¾ßÓÐһЩÓŵ㡣Ê×ÏÈ£¬ËüÄÜʹ±à³ÌЧÂÊÌá¸ß¡£ÔÚûÓÐÀ¬»øÊÕ¼¯»úÖÆµÄʱºò£¬¿ÉÄÜÒª»¨Ðí¶àʱ¼äÀ´½â¾öÒ»¸öÄѶ®µÄ´æ´¢Æ÷ÎÊÌâ¡£ÔÚÓÃJavaÓïÑÔ±à³ÌµÄʱºò£¬¿¿À¬»øÊÕ¼¯»úÖÆ¿É´ó´óËõ¶Ìʱ¼ä¡£Æä´ÎÊÇËü±£»¤³ÌÐòµÄÍêÕûÐÔ£¬ À¬»øÊÕ¼¯ÊÇJavaÓïÑÔ°²È«ÐÔ²ßÂÔµÄÒ»¸öÖØÒª²¿·Ý¡£
À¬»øÊÕ¼¯µÄÒ»¸öDZÔÚµÄȱµãÊÇËüµÄ¿ªÏúÓ°Ïì³ÌÐòÐÔÄÜ¡£JavaÐéÄâ»ú±ØÐë×·×ÙÔËÐгÌÐòÖÐÓÐÓõĶÔÏó£¬ ¶øÇÒ×îÖÕÊÍ·ÅûÓõĶÔÏó¡£ÕâÒ»¸ö¹ý³ÌÐèÒª»¨·Ñ´¦ÀíÆ÷µÄʱ¼ä¡£Æä´ÎÀ¬»øÊÕ¼¯Ëã·¨µÄ²»Í걸ÐÔ£¬ÔçÏȲÉÓõÄijЩÀ¬»øÊÕ¼¯Ëã·¨¾Í²»Äܱ£Ö¤100%ÊÕ¼¯µ½ËùÓÐµÄ·ÏÆúÄÚ´æ¡£µ±È»Ëæ×ÅÀ¬»øÊÕ¼¯Ëã·¨µÄ²»¶Ï¸Ä½øÒÔ¼°ÈíÓ²¼þÔËÐÐЧÂʵIJ»¶ÏÌáÉý£¬ÕâЩÎÊÌâ¶¼¿ÉÒÔÓÈжø½â¡£
À¬»øÊÕ¼¯µÄËã·¨·ÖÎö
JavaÓïÑԹ淶ûÓÐÃ÷È·µØËµÃ÷JVMʹÓÃÄÄÖÖÀ¬»ø»ØÊÕËã·¨£¬µ«ÊÇÈκÎÒ»ÖÖÀ¬»øÊÕ¼¯Ëã·¨Ò»°ãÒª×ö2¼þ»ù±¾µÄÊÂÇ飺£¨1£©·¢ÏÖÎÞÓÃÐÅÏ
Ïà¹ØÎĵµ£º
ÕâÊÇÒ»¸ö¼òµ¥µÄ·ÂÕæ³ÌÐò:
ÔÚÕâ¸ö·ÂÕæ³ÌÐòÖÐ,»¨Ô°Î¯Ô±»á¶¼Ï£ÍûÁ˽âÿÌìͨ¹ý´óÃŽøÈ빫԰µÄ×ÜÈËÊý.ÿ¸ö´óÃŶ¼ÓÐÒ»¸öÊ®×Ö
תÃÅ»òijÖÖÆäËûÐÎʽµÄ¼ÆÊýÆ÷,²¢ÇÒÈκÎÒ»¸öÊ®×ÖתÃŵļÆÊýÆ÷µÝÔöʱ,¾Í±íʾ¹«Ô°ÖеÄ×ÜÈËÊýµÄ¹²Ïí
¼ÆÊýÖµÒ²»áµÝÔö
package OrnamentalGarden;
import java.util.Random;
/**
* ÕâÀïʹÓõ¥¸öµ ......
Õª×Ô£ºjava JDK ʵÀý±¦µä
MD5¼´Message-Digest Algorithm 5£¨ÐÅÏ¢-ÕªÒªËã·¨ 5£©£¬ÓÃÓÚÈ·±£ÐÅÏ¢´«ÊäÍêÕûÒ»Ö¡£ÊǼÆËã»ú¹ã·ºÊ¹ÓõÄÔÓ´ÕËã·¨Ö®Ò»£¨ÓÖÒëÕªÒªËã·¨¡¢¹þÏ£Ëã·¨£©£¬Ö÷Á÷±à³ÌÓïÑÔÆÕ±éÒÑÓÐMD5ʵÏÖ¡£
¡¡¡¡ ½«Êý¾Ý£¨È纺×Ö£©ÔËËãΪÁíÒ»¹Ì¶¨³¤¶ÈÖµÊÇÔÓ´ÕËã·¨µÄ»ù´¡ÔÀ ......
Java™ ÓïÑÔ°üº¬Á½ÖÖÄÚÔÚµÄͬ²½»úÖÆ£ºÍ¬²½¿é£¨»ò·½·¨£©ºÍ volatile ±äÁ¿¡£ÕâÁ½ÖÖ»úÖÆµÄÌá³ö¶¼ÊÇΪÁËʵÏÖ´úÂëÏ̵߳ݲȫÐÔ¡£ÆäÖÐ Volatile ±äÁ¿µÄͬ²½ÐԽϲµ«ÓÐʱËü¸ü¼òµ¥²¢ÇÒ¿ªÏú¸üµÍ£©£¬¶øÇÒÆäʹÓÃÒ²¸üÈÝÒ׳ö´í¡£ÔÚÕâÆÚµÄ Java ÀíÂÛÓëʵ¼ù
ÖУ¬Brian Goetz ½«½éÉܼ¸ÖÖÕýȷʹÓà volatile ±äÁ¿µÄģʽ£¬²¢Õë¶ÔÆäÊÊÓ ......
MonoRailÊǾµäµÄMVCģʽ,ËùÒÔÆäÖÐÒ²¾ßÓÐÈý¸öÔªËØModel,Controller,View,ÆäÖÐMonoRailÊÇͨ¹ýUrlµØÖ·À´½âÎö
ÏàÓ¦µÄ²Ù×÷µÄ,Èçµ±Äã·ÃÎÊ:/home/index.rail,¶ÔÓ¦»áÖ´ÐÐHomeControllerÀàÖеÄIndex·½·¨,¶øÇÒ¿ÉÒÔ×Ô¶¯°ó¶¨²ÎÊýºÍ
RequestµÄÊý¾Ý,Èç·ÃÎÊ:/home/index.rail?id=1,Äã¿ÉÒÔÔÚHomeControllerÀàÖеÄIndex·½·¨Öж¨ÒåÒ»¸ö²ÎÊý ......
Ò» ²åÈëÅÅÐò·¨:
˵Ã÷: ÿ´Î½«Ò»¸ö´ýÅÅÐòµÄ¼Ç¼£¬°´Æä¹Ø¼ü×Ö´óС²åÈëµ½Ç°ÃæÒѾÅźÃÐòµÄ×ÓÎļþÖеÄÊʵ±Î»Öã¬Ö±µ½È«²¿¼Ç¼²åÈëÍê³ÉΪֹ¡£ Java´úÂë public class InsertSorter extends Sorter { /** * from ÆðʼλÖà ......