java·ºÐÍÏê½â
·ºÐÍ£¨Generic type »òÕßgenerics£©ÊÇ¶Ô Java ÓïÑÔµÄÀàÐÍϵͳµÄÒ»ÖÖÀ©Õ¹£¬ÒÔÖ§³Ö´´½¨¿ÉÒÔ°´ÀàÐͽøÐвÎÊý»¯µÄÀà¡£¿ÉÒÔ°ÑÀàÐͲÎÊý¿´×÷ÊÇʹÓòÎÊý»¯ÀàÐÍʱָ¶¨µÄÀàÐ͵ÄÒ»¸öռλ·û£¬¾ÍÏñ·½·¨µÄÐÎʽ²ÎÊýÊÇÔËÐÐʱ´«µÝµÄÖµµÄռλ·ûÒ»Ñù¡£
¿ÉÒÔÔÚ¼¯ºÏ¿ò¼Ü£¨Collection framework£©Öп´µ½·ºÐ͵Ķ¯»ú¡£ÀýÈ磬MapÀàÔÊÐíÄúÏòÒ»¸öMapÌí¼ÓÈÎÒâÀàµÄ¶ÔÏ󣬼´Ê¹×î³£¼ûµÄÇé¿öÊÇÔÚ¸ø¶¨Ó³É䣨map£©Öб£´æij¸öÌض¨ÀàÐÍ£¨±ÈÈçString£©µÄ¶ÔÏó¡£
ÒòΪMap.get()±»¶¨ÒåΪ·µ»ØObject£¬ËùÒÔÒ»°ã±ØÐ뽫Map.get()µÄ½á¹ûÇ¿ÖÆÀàÐÍת»»ÎªÆÚÍûµÄÀàÐÍ£¬ÈçÏÂÃæµÄ´úÂëËùʾ£º
Map m = new HashMap();
m.put("key", "blarg");
String s = (String) m.get("key");
ÒªÈóÌÐòͨ¹ý±àÒ룬±ØÐ뽫get()µÄ½á¹ûÇ¿ÖÆÀàÐÍת»»ÎªString£¬²¢ÇÒÏ£Íû½á¹ûÕæµÄÊÇÒ»¸öString¡£µ«ÊÇÓпÉÄÜijÈËÒѾÔÚ¸ÃÓ³ÉäÖб£´æÁ˲»ÊÇStringµÄ¶«Î÷£¬ÕâÑùµÄ»°£¬ÉÏÃæµÄ´úÂ뽫»áÅ׳öClassCastException¡£
ÀíÏëÇé¿öÏ£¬Äú¿ÉÄÜ»áµÃ³öÕâÑùÒ»¸ö¹Ûµã£¬¼´mÊÇÒ»¸öMap£¬Ëü½«String¼üÓ³Éäµ½StringÖµ¡£Õâ¿ÉÒÔÈÃÄúÏû³ý´úÂëÖеÄÇ¿ÖÆÀàÐÍת»»£¬Í¬Ê±»ñµÃÒ»¸ö¸½¼ÓµÄÀàÐͼì²é²ã£¬¸Ã¼ì²é²ã¿ÉÒÔ·ÀÖ¹ÓÐÈ˽«´íÎóÀàÐ͵ļü»òÖµ±£´æÔÚ¼¯ºÏÖС£Õâ¾ÍÊÇ·ºÐÍËù×öµÄ¹¤×÷¡£
·ºÐ͵ĺô¦
Java ÓïÑÔÖÐÒýÈë·ºÐÍÊÇÒ»¸ö½Ï´óµÄ¹¦ÄÜÔöÇ¿¡£²»½öÓïÑÔ¡¢ÀàÐÍϵͳºÍ±àÒëÆ÷ÓÐÁ˽ϴóµÄ±ä»¯£¬ÒÔÖ§³Ö·ºÐÍ£¬¶øÇÒÀà¿âÒ²½øÐÐÁË´ó·ÐÞ£¬ËùÒÔÐí¶àÖØÒªµÄÀ࣬±ÈÈ缯ºÏ¿ò¼Ü£¬¶¼ÒѾ³ÉΪ·ºÐÍ»¯µÄÁË¡£Õâ´øÀ´Á˺ܶàºÃ´¦£º
· ÀàÐÍ°²È«¡£·ºÐ͵ÄÖ÷ҪĿ±êÊÇÌá¸ß Java ³ÌÐòµÄÀàÐÍ°²È«¡£Í¨¹ýÖªµÀʹÓ÷ºÐͶ¨ÒåµÄ±äÁ¿µÄÀàÐÍÏÞÖÆ£¬±àÒëÆ÷¿ÉÒÔÔÚÒ»¸ö¸ßµÃ¶àµÄ³Ì¶ÈÉÏÑéÖ¤ÀàÐͼÙÉ衣ûÓзºÐÍ£¬ÕâЩ¼ÙÉè¾ÍÖ»´æÔÚÓÚ³ÌÐòÔ±µÄÍ·ÄÔÖУ¨»òÕßÈç¹ûÐÒÔ˵Ļ°£¬»¹´æÔÚÓÚ´úÂë×¢ÊÍÖУ©¡£
Java ³ÌÐòÖеÄÒ»ÖÖÁ÷Ðм¼ÊõÊǶ¨ÒåÕâÑùµÄ¼¯ºÏ£¬¼´ËüµÄÔªËØ»ò¼üÊǹ«¹²ÀàÐ͵ģ¬±ÈÈç“StringÁб픻òÕß“Stringµ½StringµÄÓ³É䔡£Í¨¹ýÔÚ±äÁ¿ÉùÃ÷ÖⶻñÕâÒ»¸½¼ÓµÄÀàÐÍÐÅÏ¢£¬·ºÐÍÔÊÐí±àÒëÆ÷ʵʩÕâЩ¸½¼ÓµÄÀàÐÍÔ¼Êø¡£ÀàÐÍ´íÎóÏÖÔھͿÉÒÔÔÚ±àÒëʱ±»²¶»ñÁË£¬¶ø²»ÊÇÔÚÔËÐÐʱµ±×÷ClassCastExceptionչʾ³öÀ´¡£½«ÀàÐͼì²é´ÓÔËÐÐʱŲµ½±àÒëʱÓÐÖúÓÚÄú¸üÈÝÒ×ÕÒµ½´íÎ󣬲¢¿ÉÌá¸ß³ÌÐòµÄ¿É¿¿ÐÔ¡£
· Ïû³ýÇ¿ÖÆÀàÐÍת»»¡£·ºÐ͵ÄÒ»¸ö¸½´øºÃ´¦ÊÇ£¬Ïû³ýÔ´´úÂëÖеÄÐí¶àÇ¿ÖÆÀàÐÍת»»¡£ÕâʹµÃ´úÂë¸ü¼Ó¿É¶Á£¬²¢ÇÒ¼õÉÙÁ˳ö´í»ú»á¡£
¾¡¹Ü¼õÉÙÇ¿ÖÆÀàÐÍת»»¿ÉÒÔ½µµÍʹÓ÷ºÐÍÀàµÄ´úÂëµÄÂÞà³̶ȣ¬µ«ÊÇÉ
Ïà¹ØÎĵµ£º
AntÓ÷¨——Õª×Ô¡¶ÇáÁ¿¼¶Java EEÆóÒµÓ¦ÓÃʵս¡·
1.6 AntµÄ°²×°ºÍʹÓÃ
AntÊÇÒ»ÖÖ»ùÓÚJavaµÄÉú³É¹¤¾ß
¡£´Ó×÷ÓÃÉÏÀ´¿´£¬ËüÓÐЩÀàËÆÓÚC±à³Ì£¨Unixƽ̨ÉÏʹÓý϶ࣩÖеÄMake¹¤¾ß£¬C/C++ÏîÄ¿
¾³£Ê¹ÓÃMake¹¤¾ßÀ´¹ÜÀíÕû¸öÏîÄ¿µÄ±àÒë¡¢Éú³É¡£
MakeʹÓÃShellÃüÁîÀ´¶¨Òå
Éú³ÉÈÎÎñ£¬²¢¶¨ÒåÈÎÎñÖ®¼äµÄÒÀÀµ¹Øϵ£¬ÒÔ±ãË ......
Çë²»Òª°ÑÄãµÄѧϰJava֮·ºÍÆäËü¼ÆËã»ú¼¼Êõ·Ö¿ª¿´´ý£¬¼¼ÊõµÄÁªÏµÍùÍùÊÇǧ˿ÍòÂƵģ¬ÄãÓ¦¸ÃÕÆÎÕһЩѧϰJavaËùÉæ¼°µÄ»ù´¡ÖªÊ¶£¬¶ÔÓÚ “CLASSPATHÒªÔõôÉèÖð¡”¡¢“¹òÇóJDKÏÂÔصØÖ·”µÈµÈÎÊÌ⣬Äã²»¸ÃÎÊ£¬ÒòΪInternetÉÏÌ«¶à´ð°¸ÁË£¬ÉõÖÁ»»¸ö½Ç¶È˵£¬ÄãÊDz»ÊÇ»¹²»ÊʺÏÖ±½Óѧϰ±à³Ì£¿
1£©Âò±¾JavaѧϰÓà ......
ѸÀ×ÃæÊÔ»ØÀ´£¬ÓÃÁËÕûÕûÒ»ÏÂÎ磨²»ÖªµÀÔõô˵ÁË£¬ÆäÖеȴýʱ¼ä¶¼¿ì2СʱÁË£©£¬×Ô¼º¸Ð¾õ±ÊÊÔºÍÉÏ»ú»¹¿ÉÒÔ£¬µ«¼¼ÊõÃæ̸ÕâÒ»¹Ø´ðµÃ²»Ì«ºÃ£¬ÏÖÔÚÔٴθоõ»¥ÁªÍø¹«Ë¾ÓëÒ»°ãÈí¼þ¹«Ë¾µÄÇø±ðÁË£¬ÆäÖÐÒ»µã¾ÍÊÇ»¥ÁªÍøÓ¦ÓÃÔÚÐÔÄÜÉÏÒªÇóºÜ¸ß£¬Ì¸ÁËÒ»¸öСʱ´ó²¿·ÖÌâÄ¿¸Ð¾õ¶¼ÔÚ̸ÂÛÐÔÄÜÎÊÌ⣬×Ô¼ºÔÚ·½ÃæÒ»Ö±ÊÇÈõÏº¹°¡£º£¨
×Ðϸ»ØÒäÁË ......
ÏÈ¿´¿´ÏÂÃæµÄ´úÂ룬´ó¼Ò²Â²ÂÊä³öÊÇʲô
package com.captain.test;
public class ArrayTest {
public static void main(String[] args){
//н¨Ò»¸ö¶ÔÏó£¨OneNum£©Êý×飨¸³ÖµÎª5¡¢3¡¢4£©
OneNum[] ac = {new OneNum(5),new OneNum(3),new OneNum(4)};
//н¨Ò»¸öÓëacͬ³¤¶ÈµÄ¶ÔÏó£¨OneNum£©Êý×é
OneNum[] n ......
³õ̽javaÄÚ´æ»úÖÆ_¶ÑºÍÕ»
ÎÊÌâµÄÒýÈ룺
ÎÊÌâÒ»£º
String str1 = "abc";
String str2 = "abc";
System.out.println(str1==str2); //true
ÎÊÌâ¶þ£º
String str1 =new String ("abc");
String str2 =new String ("abc");
System.out.println(str1==str2); // false
ÎÊÌâÈý£º
String s1 = "ja";
String s2 = "v ......