Java ·ºÐ͵ĽâÎö
·ºÐÍÊÇJ2SE 5.0×îÖØÒªµÄÌØÐÔ¡£ËûÃÇÈÃÄãдһ¸ötype(Àà»ò½Ó¿Ú£©ºÍ´´½¨Ò»¸öʵÀýͨ¹ý´«µÝÒ»¸ö»ò¶à¸öÒýÓÃÀàÐÍ¡£Õâ¸öʵÀýÊÜÏÞÓÚÖ»ÄÜ×÷ÓÃÓÚÕâЩÀàÐÍ¡£
±ÈÈ磬ÔÚjava 5£¬java.util.List ÒѾ±»·º»¯¡£µ±½¨Á¢Ò»¸ölist¶ÔÏóʱ£¬Äãͨ¹ý´«µÝÒ»¸öjavaÀàÐͽ¨Á¢Ò»¸öListʵÀý£¬´ËlistʵÀýÖ»ÄÜ×÷ÓÃÓÚËù´«µÝµÄÀàÐÍ¡£ÕâÒâζ×ÅÈç¹ûÄã´«µÝÒ»¸öString ,´ËListʵÀýÖ»ÄÜÓµÓÐString¶ÔÏó£»Èç¹ûÄã´«µÝÒ»¸öInteger£¬´ËʵÀýÖ»ÄÜ´æÖüInteger¶ÔÏó¡£³ýÁË´´½¨²ÎÊý»¯µÄÀàÐÍ£¬Ä㻹ÄÜ´´½¨²ÎÊý»¯µÄº¯Êý.
·ºÐ͵ĵÚÒ»¸öºÃ´¦ÊDZàÒëʱµÄÑϸñÀàÐͼì²é¡£ÕâÊǼ¯ºÏ¿ò¼Ü×îÖØÒªµÄÌص㡣´ËÍâ,·ºÐÍÏû³ýÁ˾ø´ó¶àÊýµÄÀàÐÍת»»¡£ÔÚJDK 5.0֮ǰ£¬µ±ÄãʹÓü¯ºÏ¿ò¼Üʱ£¬Äã²»µÃ²»½øÐÐÀàÐÍת»»¡£
ÎÒÃÇÀ´Ì½ÌÖÒ»ÏÂÈçºÎ²Ù×÷·ºÐÍ¡£ËüµÄµÚÒ»²¿·ÖÊǓûÓзºÐ͵ÄÈÕ×Ó”£¬ÏÈÈÃÎÒÃÇ»ØÒäÀÏ°æ±¾JDKµÄ²»±ã¡£È»ºó£¬¾ÙһЩ·ºÐ͵ÄÀý×Ó¡£ÔÚÌÖÂÛÍêÓï·¨ÒÔ¼°Óн緺Ð͵ÄʹÓÃÖ®ºó£¬ÎÄÕÂ×îºóÒ»Õ½«½âÊÍÈçºÎд·ºÐÍ¡£
ûÓзºÐ͵ÄÈÕ×Ó
ËùÓеÄjavaÀ඼Դ×Ôjava.lang.Object,ÕâÒâζ×ÅËùÓеÄJAVA¶ÔÏóÄÜת»»³ÉObject¡£
Òò´Ë£¬ÔÚ֮ǰµÄJDKµÄ°æ±¾ÖУ¬ºÜ¶à¼¯ºÏ¿ò¼ÜµÄº¯Êý½ÓÊÜÒ»¸öObject²ÎÊý¡£
ËùÒÔ£¬collectionsÊÇÒ»¸öÄܳÖÓÐÈκζÔÏóµÄ¶àÓÃ;¹¤¾ß£¬µ«´øÀ´Á˲»Á¼µÄºó¹û¡£
¾Ù¸ö¼òµ¥µÄÀý×Ó£¬ÔÚJDK 5.0µÄ֮ǰ°æ±¾ÖУ¬ÀàListµÄº¯Êýadd½ÓÊÜÒ»¸öObject²ÎÊý£º
1
public boolean add(java.lang.Object element)
ËùÒÔÄãÄÜ´«µÝÈκÎÀàÐ͸øadd¡£ÕâÊǹÊÒâÕâôÉè¼ÆµÄ¡£·ñÔò£¬ËüÖ»ÄÜ´«µÝijÖÖÌض¨µÄ¶ÔÏó£¬ÕâÑù¾Í»á³öÏÖ¸÷ÖÖListÀàÐÍ£¬È磬StringList, EmployeeList, AddressListµÈ¡£
addͨ¹ýObject´«µÝÄÜ´øÀ´ºÃ´¦,ÏÖÔÚÎÒÃÇ¿¼ÂÇgetº¯Êý(·µ»ØListÖеÄÒ»¸öÔªËØ).ÈçÏÂÊÇJDK 5֮ǰ°æ±¾µÄ¶¨Ò壺
1
public java.lang.Object get(int index) throws IndexOutOfBoundsException
get·µ»ØÒ»¸öObject.²»ÐÒµÄÊÂÇé´Ó´Ë¿ªÊ¼ÁË.¼ÙÈçÄã´¢´æÁËÁ½¸öString¶ÔÏóÔÚÒ»¸öListÖÐ:
1
2
3
List stringList1 = new ArrayList();
stringList1.add("Java 5");
stringList1.add("with generics");
µ±ÄãÏë´ÓstringList1È¡µÃÒ»¸öÔªËØʱ,ÄãµÃµ½ÁËÒ»¸öObject.ΪÁ˲Ù×÷ÔÀ´µÄÀàÐÍÔªËØ,Äã²»µÃ²»°ÑËüת»»ÎªString¡£
1
String s1 = (String) stringList1.get(0);
·ºÐÍÈëÃÅ
ÏñÒ»¸öº¯ÊýÄܽÓÊܲÎÊýÒ»Ñù,Ò»¸ö·ºÐÍÒ²ÄܽÓÊܲÎÊý.Õâ¾ÍÊÇÒ»¸ö·ºÐ;³£±»³ÆΪһ¸ö²ÎÊý»¯ÀàÐ͵ÄÔÒò.µ«ÊDz»Ïñº¯ÊýÓÃ()´«µÝ²ÎÊ
Ïà¹ØÎĵµ£º
ÖØÐÂÀ´ÈÏʶһÏÂÄÚ²¿ÀàµÄÇø±ð
1
Static member class£¨¾²Ì¬³ÉÔ±Àࣩ
ÀàÉùÃ÷Öаüº¬“static”¹Ø¼ü×ÖµÄÄÚ²¿Àà¡£ÈçÒÔÏÂʾÀý´úÂ룬
Inner1/Inner2/Inner3/Inner4¾ÍÊÇOuterµÄËĸö¾²Ì¬³ÉÔ±Àà¡£¾²Ì¬³ÉÔ±ÀàµÄʹÓ÷½Ê½ÓëÒ»°ã¶¥²ãÀàµÄʹÓ÷½Ê½»ù±¾Ïàͬ¡£
publi ......
ÕâÊÇһЩÏ൱²»´íµÄÖҸ棡ÿ¸ö¹æÔò¶¼ºÜÓзÖÁ¿£¡¶¼Êdz¤ÆÚ¾Ñé»ýÀÛµÄ×ܽᣬϣÍûÄܶÔÄúÓÐËù°ïÖú£¬Ê¹Äú±à³ö¸ßÖÊÁ¿µÄJAVA´úÂë¡£ÖÐÎÄJAVA¼¼ÊõÍøfX
W,c6I/R!_3Bb
ÖÐÎÄJAVA¼¼ÊõÍø6o9yV+M
u+V2Nfr5vm
(1)ÀàÃûÊ××ÖĸӦ¸Ã´óд¡£×ֶΡ¢·½·¨ÒÔ¼°¶ÔÏ󣨾ä±ú£©µÄÊ××ÖĸӦСд¡£¶ÔÓÚËùÓбêʶ·û£¬ÆäÖаüº¬µÄËù
Óе¥´Ê¶¼Ó¦½ô¿¿ ......
1.»ù±¾¸ÅÄîµÄÀí½â
¾ø¶Ô·¾¶£º¾ø¶Ô·¾¶¾ÍÊÇÄãµÄÖ÷Ò³ÉϵÄÎļþ»òĿ¼ÔÚÓ²ÅÌÉÏÕæÕýµÄ·¾¶£¬(URLºÍÎïÀí·¾¶)ÀýÈ磺
C:xyz est.txt ´ú±íÁËtest.txtÎļþµÄ¾ø¶Ô·¾¶¡£http://www.sun.com/index.htmÒ²´ú±íÁËÒ»¸öURL¾ø¶Ô·¾¶¡£
Ïà¶Ô·¾¶£ºÏà¶ÔÓëij¸ö»ù׼Ŀ¼µÄ·¾¶¡£°üº¬WebµÄÏà¶Ô·¾¶£¨HTMLÖеÄÏà¶ÔĿ¼£©£¬ÀýÈ磺ÔÚ
ServletÖÐ ......
http://20921556.javaeye.com/blog/263974
¹Ø¼ü×Ö: java jar
JavaµÄÒ»ÖÖÎĵµ¸ñʽ£¬JARÎļþ·Ç³£ÀàËÆZIPÎļþ£¬Ò²ÊÇÒ»¸öѹËõÎļþ¡£JARÎļþÓëZIPÎļþΩһµÄÇø±ð¾ÍÊÇÔÚJARÎļþµÄÄÚÈÝÖУ¬Ëü°üº¬ÁËÒ»¸ömeta-inf/manifest.mfÎļþ£¬Õâ¸öÎļþÊÇÔÚÉú³ÉJARÎļþµÄʱºò×Ô¶¯´´½¨µÄ¡£ÐèҪעÒâµÄÊÇ£¬JARÎļþ²»ÐèÒª½ø ......