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

javaÖеÄstringÀàÐÍÈ«Ãæ½âÎö

1. Ê×ÏÈString²»ÊôÓÚ8ÖÖ»ù±¾Êý¾ÝÀàÐÍ£¬StringÊÇÒ»¸ö¶ÔÏó¡£
¡¡¡¡ÒòΪ¶ÔÏóµÄĬÈÏÖµÊÇnull£¬ËùÒÔStringµÄĬÈÏÖµÒ²ÊÇnull£»µ«ËüÓÖÊÇÒ»ÖÖÌØÊâµÄ¶ÔÏó£¬ÓÐÆäËü¶ÔÏóûÓеÄһЩÌØÐÔ¡£
¡¡¡¡2. new String()ºÍnew String(“”)¶¼ÊÇÉêÃ÷Ò»¸öеĿÕ×Ö·û´®£¬ÊÇ¿Õ´®²»ÊÇnull£»
¡¡¡¡3. String str=”kvill”£»
String str=new String (“kvill”);µÄÇø±ð£º
¡¡¡¡ÔÚÕâÀÎÒÃDz»Ì¸¶Ñ£¬Ò²²»Ì¸Õ»£¬Ö»Ïȼòµ¥ÒýÈë³£Á¿³ØÕâ¸ö¼òµ¥µÄ¸ÅÄî¡£
¡¡¡¡³£Á¿³Ø(constant pool)Ö¸µÄÊÇÔÚ±àÒëÆÚ±»È·¶¨£¬²¢±»±£´æÔÚÒѱàÒëµÄ.classÎļþÖеÄһЩÊý¾Ý¡£Ëü°üÀ¨Á˹ØÓÚÀà¡¢·½·¨¡¢½Ó¿ÚµÈÖеij£Á¿£¬Ò²°üÀ¨×Ö·û´®³£Á¿¡£
¡¡¡¡¿´Àý1£º
String s0=”kvill”;
String s1=”kvill”;
String s2=”kv” + “ill”;
System.out.println( s0==s1 );
System.out.println( s0==s2 );
¡¡¡¡½á¹ûΪ£º
true
true
¡¡¡¡Ê×ÏÈ£¬ÎÒÃÇÒªÖªµÀJava»áÈ·±£Ò»¸ö×Ö·û´®³£Á¿Ö»ÓÐÒ»¸ö¿½±´¡£
¡¡¡¡ÒòΪÀý×ÓÖеÄs0ºÍs1ÖеĔkvill”¶¼ÊÇ×Ö·û´®³£Á¿£¬ËüÃÇÔÚ±àÒëÆھͱ»È·¶¨ÁË£¬ËùÒÔs0==s1Ϊtrue£»¶ø”kv”ºÍ”ill”Ò²¶¼ÊÇ×Ö·û´®³£Á¿£¬µ±Ò»¸ö×Ö·û´®Óɶà¸ö×Ö·û´®³£Á¿Á¬½Ó¶ø³Éʱ£¬Ëü×Ô¼º¿Ï¶¨Ò²ÊÇ×Ö·û´®³£Á¿£¬ËùÒÔs2ҲͬÑùÔÚ±àÒëÆھͱ»½âÎöΪһ¸ö×Ö·û´®³£Á¿£¬ËùÒÔs2Ò²Êdz£Á¿³ØÖДkvill”µÄÒ»¸öÒýÓá£
¡¡¡¡ËùÒÔÎÒÃǵóös0==s1==s2;
¡¡¡¡ÓÃnew String() ´´½¨µÄ×Ö·û´®²»Êdz£Á¿£¬²»ÄÜÔÚ±àÒëÆÚ¾ÍÈ·¶¨£¬ËùÒÔnew String() ´´½¨µÄ×Ö·û´®²»·ÅÈë³£Á¿³ØÖУ¬ËüÃÇÓÐ×Ô¼ºµÄµØÖ·¿Õ¼ä¡£
¡¡¡¡¿´Àý2£º
String s0=”kvill”;
String s1=new String(”kvill”);
String s2=”kv” + new String(“ill”);
System.out.println( s0==s1 );
System.out.println( s0==s2 );
System.out.println( s1==s2 );
¡¡¡¡½á¹ûΪ£º
false
false
false
¡¡¡¡Àý2ÖÐs0»¹Êdz£Á¿³ØÖДkvill”µÄÓ¦Óã¬s1ÒòΪÎÞ·¨ÔÚ±àÒëÆÚÈ·¶¨£¬ËùÒÔÊÇÔËÐÐʱ´´½¨µÄжÔÏó”kvill”µÄÒýÓã¬s2ÒòΪÓкó°ë²¿·Önew String(“ill”)ËùÒÔÒ²ÎÞ·¨ÔÚ±àÒëÆÚÈ·¶¨£¬ËùÒÔÒ²ÊÇÒ»¸öд´½¨¶ÔÏó”kvill”µÄÓ¦ÓÃ;Ã÷°×ÁËÕâЩҲ¾ÍÖªµÀΪºÎµÃ³ö´Ë½á¹ûÁË¡£
¡¡¡¡4. String.intern()£º
¡¡¡¡ÔÙ²¹³ä½éÉÜÒ»µã£º´æÔÚÓÚ.classÎļþÖеij£Á¿³Ø£¬ÔÚÔËÐÐÆÚ±»JVM×


Ïà¹ØÎĵµ£º

javaÏ̳߳صÄÔ­ÀíÓëʵÏÖ

javaÏ̳߳صÄÔ­ÀíÓëʵÏÖ



[·ÖÏí]Java Ï̳߳صÄÔ­ÀíÓëʵÏÖ2008-07-18
14:53------------------------------------------------------------------------------------------------
Õ⼸ÌìÖ÷ÒªÊÇ¿ñ¿´Ô´³ÌÐò£¬ÔÚÃÖ²¹ÁËһЩÒÔǰ֪ʶ¿Õ°×µÄͬʱ£¬Ò²Ñ§»áÁ˲»ÉÙеÄ֪ʶ£¨±ÈÈç NIO£©£¬»òÕß³ÆΪм¼Êõ°É ......

ÓÃjavaµ÷ÓÃoracle´æ´¢¹ý³Ì×ܽá

ÉùÃ÷£º
ÒÔϵÄÀý×Ó²»Ò»¶¨ÕýÈ·£¬Ö»ÊÇΪÁËÑÝʾ´ó¸ÅµÄÁ÷³Ì¡£
Ò»£ºÎÞ·µ»ØÖµµÄ´æ´¢¹ý³Ì
´æ´¢¹ý³ÌΪ£º
CREATE OR REPLACE PROCEDURE TESTA(PARA1 IN VARCHAR2,PARA2 IN VARCHAR2)  AS
BEGIN
   INSERT INTO HYQ.B_ID (I_ID,I_NAME) VALUES (PARA1, PARA2);
END TESTA;
È»ºóÄØ£¬ÔÚjavaÀïµ÷ÓÃʱ¾ÍÓÃÏÂÃæµÄ´ ......

java Òì³£Exception ¼¯


<!--
/* Font Definitions */
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:ËÎÌå;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@SimSun&qu ......

javaÖкº×ÖתƴÒô

´úÂëÈçÏ£º
¡¡¡¡ÒÔÏÂΪÒýÓõÄÄÚÈÝ£º
¡¡¡¡package com.example.pinyin.demo2;
¡¡¡¡import net.sourceforge.pinyin4j.PinyinHelper;
¡¡¡¡import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
¡¡¡¡import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
¡¡¡¡import net.sourceforge.pinyin4j.form ......

ÖÂJavaÐÂÊÖµÄÒ»·âÐÅ£¨bxÈí¼þС×é°æ£©

ÏÂÃæÕâƪÎÄÕÂÊÇ̨ÍåÖøÃûJavaÂÛ̳“Javaworld”µÄÒ»¸ö×ÊÉî°æÖ÷дµÄÒ»·â¶ÔJavaÐÂÊÖµÄÐÅ£¬Ï£ÍûС×é³ÉÔ±×Ðϸ¿´Ï Äã»áѧµ½ºÜ¶àµÄ¡¢¡¢¡¢¡¢
 親愛µÄ java ÐÂÊÖ們 :
ºÜ¸ß興Äã們願Òâ來這裡¹²Í¬學習,
Java 這個語ÑÔ, ÒÑ&# ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ