Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

javaÖÐStirngÀàµÄÉ

³£¿´µ½ºÜ¶àÈËÌÖÂÛjavaÖйØÓÚStringµÄÎÊÌâ,ÎÒÒ²¾ÍÓеãÐËȤÁË,¼øÓÚÍøÉϺܶàÈËдµÄ¶¼²î±ðºÜ´ó,
ͬÑùµÄÎÊÌⶼÊDz»Í¬µÄ˵·¨,ÎÒºÜÃÔºý,»¨ÁËÒ»ÍíÉ϶ÁÁËJava Virtual Machine SpecificationºÍ
The Java Language SpecificationµÄһЩÕ½Ú,×öÁ˺ܶàÊÔÑé,×ܽáÁËһϹØÓÚStringµÄÄÚÈÝ,»¹
ÓкܶàÄÚÈÝÎÒÒ²²»È·¶¨,ÔÚÏÂÃæÒ²¶¼Ìá³öÀ´ÁË,Ï£Íû¸ßÊÖÄÜÖ¸Õý.
Constant Pool³£Á¿³ØµÄ¸ÅÄî:
ÔÚ½²µ½StringµÄһЩÌØÊâÇé¿öʱ,×Ü»áÌáµ½String Pool»òÕßConstant Pool,µ«ÊÇÎÒÏëºÜ¶àÈ˶¼²»Ì«
Ã÷°×Constant Poolµ½µ×ÊǸöÔõôÑùµÄ¶«Î÷,ÔËÐеÄʱºò´æ´¢ÔÚÄÄÀï,ËùÒÔÔÚÕâÀïÏÈ˵һÏÂConstant PoolµÄÄÚÈÝ.
String PoolÊǶÔÓ¦ÓÚÔÚConstant PoolÖд洢String³£Á¿µÄÇøÓò.Ï°¹ß³ÆΪString Pool,Ò²ÓÐÈ˳ÆΪ
String Constant Pool.ºÃÏñûÓÐÕýʽµÄÃüÃû??
ÔÚjava±àÒëºÃµÄclassÎļþÖÐ,ÓиöÇøÓò³ÆΪConstant Pool,ËûÊÇÒ»¸öÓÉÊý×é×é³ÉµÄ±í,ÀàÐÍ
Ϊcp_info constant_pool[],ÓÃÀ´´æ´¢³ÌÐòÖÐʹÓõĸ÷ÖÖ³£Á¿,°üÀ¨Class/String/IntegerµÈ¸÷
ÖÖ»ù±¾JavaÊý¾ÝÀàÐÍ,ÏêÇé²Î¼ûThe Java Virtual Machine Specification 4.4Õ½Ú.
¶ÔÓÚConstant Pool,±íµÄ»ù±¾Í¨ÓýṹΪ:
cp_info {
        u1 tag;
        u1 info[];
}
tagÊÇÒ»¸öÊý×Ö,ÓÃÀ´±íʾ´æ´¢µÄ³£Á¿µÄÀàÐÍ,ÀýÈç8±íʾStringÀàÐÍ,5±íʾLongÀàÐÍ,info[]¸ù¾Ý
ÀàÐÍÂëtagµÄ²»Í¬»á·¢ÉúÏàÓ¦±ä»¯.
¶ÔÓÚStringÀàÐÍ,±íµÄ½á¹¹Îª:
CONSTANT_String_info {
        u1 tag;
        u2 string_index;
}
tag¹Ì¶¨Îª8,string_indexÊÇ×Ö·û´®ÄÚÈÝÐÅÏ¢,ÀàÐÍΪ:
CONSTANT_Utf8_info {
        u1 tag;
        u2 length;
        u1 bytes[length];
}
tag¹Ì¶¨Îª1,lengthΪ×Ö·û´®µÄ³¤¶È,bytes[length]Ϊ×Ö·û´®µÄÄÚÈÝ.
(ÒÔÏ´úÂëÔÚjdk6ÖбàÒë)
ΪÁËÏêϸÀí½âConstant PoolµÄ½á¹¹,ÎÒÃDzο´Ò»Ð©´úÂë:
    String s1 = "sss111";
    String s2 = "sss222";
    System.out.println(s1 + " " + s2);
ÓÉÓÚ"sss111"ºÍ"sss222"¶¼ÊÇ×Ö·û´®³£Á¿,ÔÚ±àÒëÆÚ¾ÍÒѾ­´´½¨ºÃÁË´æ´¢ÔÚclassÎļþÖÐ.
ÔÚ±àÒëºóµÄclassÎļþÖлá´æÔÚÕâ2¸ö³£Á¿µÄ¶ÔÓ¦±íʾ:
08


Ïà¹ØÎĵµ£º

¿ª²©——¡¾×ª¡¿JavaÖÐDAOµÄʵÏÖ

×î½üѧϰÖÐ×ÜÊǸоõÍ£Ö¹²»Ç°ÁË£¬µ½´ïÒ»¸öÆ¿¾±£¬¾­³£Ð´µ½Ò»¸öµØ·½»á¾õµÃÕâ¸ö¶«Î÷ѧ¹ýµ«Óв»ÊÇÄÇôµÄÇå³þ£¬Ò»ÖÖËƶ®·Ç¶®µÄ¸Ð¾õ£¬ËùÒÔ¾ö¶¨Õҵط½°ÑÿÌìËùѧϰµÄ»òÓÐÓõĶ«Î÷¼Ç¼ÏÂÀ´£¬½ñÌ쿪ʼÕâÀォÊÇÎҵļ¼Êõ¿â£¬ÎÒ»áÓëËùÓа®ºÃJAVAµÄÅóÓÑÒ»Æðѧϰ£¬Ò»Æð½ø²½¡£½ñÌìÊÇ¿ª²©µÚÒ»Ì죬ÕýºÃÔÚ¸´Ï°DAOÉè¼Æģʽ£¬¿´µ½Ò»Æ¬²»´íµÄ½²½â£ ......

JAVA±éÀúÒ»¸öÎļþ¼ÐÖеÄËùÓÐÎļþ

ÔÚʵ¼ÊÏîÄ¿Öиø¶¨Ò»Îļþ¼Ð£¬µÃµ½Õâ¸öÎļþ¼ÐÏÂËùÓеÄÎļþÕâÑùµÄÐèÇó²¢²»ÊǺܶ࣬¸ü¶àµÄÊDzéÕÒ»òÊÇɾ³ýijһ¾ßÌåµÄÎļþ
import java.io.File;
import java.util.ArrayList;
public class FileTest {
 private static ArrayList<String> filelist = new ArrayList<String>();
 
 public stati ......

JAVAÀàȨÏÞ

1¡¢ClassÀàµÄ·ÃÎÊȨÏÞ£º
public£º¿ÉÒÔ¹©ËùÓеÄÀà·ÃÎÊ¡£
ĬÈÏ(°ü·ÃÎÊȨÏÞ)£ºÄ¬ÈÏ¿ÉÒÔ³ÆΪfriendlyµ«ÊÇ£¬javaÓïÑÔÖÐÊÇûÓÐfriendlyÕâ¸öÐÞÊηûµÄ£¬ÕâÑù³ÆºôÓ¦¸ÃÊÇÀ´Ô´ÓÚc++¡£Ä¬ÈϵķÃÎÊȨÏÞÊÇ°ü¼¶·ÃÎÊȨÏÞ¡£
      ¼´Èç¹ûдÁËÒ»¸öÀàûÓÐд·ÃÎÊȨÏÞÐÞÊηû£¬ÄÇô¾ÍÊÇĬÈϵķÃÎÊȨÏÞ£¬ ......

JavaʼþÄ£ÐÍѧϰ£¨2£©

       µ±³ÌÐòµÄij¸öÄ£¿é±»µ÷ÓõÄʱ¿Ì²»È·¶¨£¬¾ÍÀàËÆÓڵȴýij¸öʼþµÄ·¢Éú¡£Õâʱ£¬¿ÉÒÔ¶¨Òå×Ô¼ºµÄʼþ½øÐÐÏàÓ¦µÄ´¦Àí¡£±ÈÈ磬µÈ´ýÓû§µÄÒ»´ÎÊäÈëµÈ¡£JavaµÄʼþÄ£ÐÍÒÀÀµÓÚίÍУ¬Í¨¹ý»Øµ÷·½·¨½øÐÐÏàÓ¦µÄʼþ´¦Àí¡£ÔÚʼþÔ´ÖУ¬»áÓÐfireXXXEvent()¾ÍÊǼ¤»îÏàÓ¦µÄʼþ£¬ÆäÖлá±éÀúʼþÔ´µÄ¼àÌýÆ ......

javaÓÅÊƼ°¿çƽ̨ԭÀí

Ò»¡£javaµÄÓÅÊÆ
1.ÃæÏò¶ÔÏó
2.¿çƽ̨
java×÷ΪһÖÖÍøÂçÓïÑÔ£¬ÆäÔ´´úÂë±»±àÒë³É.class×Ö½ÚÂ룬ÓÉjavaÐéÄâ»úÖ´ÐУ¬
3.¼òµ¥
Ò»£¬java·ç¸ñÀàËÆc++£¬c++³ÌÐòÔ±ÄܺܿìµØÕÆÎÕjava
¶þ£¬javaÞðÆúÁËÖ¸Õ룬½á¹¹£¬Ã¶¾ÙµÈÒ×Òý·¢ÄÚ´æÎÊÌâµÄ²Ù×÷
Èý£¬javaÌṩÁ˷ḻµÄapi£¬Äܹ»°ïÖúÎÒÃÇ¿ìËÙ¿ª·¢
4.½¡×³
Ò»¡£Ç¿ÀàÐ͵ģ¬ÀàÐͼì²éºÜÑ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ