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

JavaÖÐ×Ö·û´®£¨String£©µÄ´æ´¢ºÍ¸³ÖµÔ­Àí

¿ÉÄܺܶàjavaµÄ³õѧÕ߶ÔStringµÄ´æ´¢ºÍ¸³ÖµÓÐÃÔ»ó£¬ÒÔÏÂÊÇÒ»¸öºÜ¼òµ¥µÄ²âÊÔÓÃÀý£¬ÄãÖ»ÐèÒª»¨¼¸·ÖÖÓʱ¼ä±ã¿ÉÀí½â¡£
1.ÔÚ¿´Àý×Ó֮ǰ£¬È·±£ÄãÀí½âÒÔϼ¸¸öÊõÓ
 
Õ» £ºÓÉJVM·ÖÅäÇøÓò£¬ÓÃÓÚ±£´æÏß³ÌÖ´ÐеĶ¯×÷ºÍÊý¾ÝÒýÓá£Õ»ÊÇÒ»¸öÔËÐеĵ¥Î»£¬JavaÖÐÒ»¸öÏ߳̾ͻáÏàÓ¦ÓÐÒ»¸öÏß³ÌÕ»ÓëÖ®¶ÔÓ¦¡£
 
¶Ñ £ºÓÉJVM·ÖÅäµÄ£¬ÓÃÓÚ´æ´¢¶ÔÏóµÈÊý¾ÝµÄÇøÓò¡£
 
³£Á¿³Ø £ºÔÚ¶ÑÖзÖÅä³öÀ´µÄÒ»¿é´æ´¢ÇøÓò£¬ÓÃÓÚ´æ´¢ÏÔʽ µÄString£¬float»òÕßinteger.ÀýÈçString str="abc"; abcÕâ¸ö×Ö·û´®ÊÇÏÔʽÉùÃ÷£¬ËùÒÔ´æ´¢ÔÚ³£Á¿³Ø¡£
2.¿´Õâ¸öÀý×Ó£¬ÓÃJDK5+junit4.5дµÄÀý×Ó£¬Íêȫͨ¹ý²âÊÔ¡£
 import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertSame;
import org.junit.Test;
/**
* @author Heis
*
*/
public class StringTest{
@Test
public void testTheSameReference1(){
String str1="abc";
String str2="abc";
String str3="ab"+"c";
String str4=new String(str2);

//str1ºÍstr2ÒýÓÃ×Ô³£Á¿³ØÀïµÄͬһ¸östring¶ÔÏó
assertSame(str1,str2);
//str3ͨ¹ý±àÒëÓÅ»¯£¬Óëstr1ÒýÓÃ×Ôͬһ¸ö¶ÔÏó
assertSame(str1,str3);
//str4ÒòΪÊÇÔÚ¶ÑÖÐÖØзÖÅäµÄÁíÒ»¸ö¶ÔÏó£¬ËùÒÔËüµÄÒýÓÃÓëstr1²»Í¬
assertNotSame(str1,str4);
}

}
 
µÚÒ»¸ö¶ÏÑԺܺÃÀí½â£¬ÒòΪÔÚ½âÎöµÄʱºò£¬"abc"±»´æ´¢ÔÚ³£Á¿³ØÖУ¬str1ºÍstr2µÄÒýÓö¼ÊÇÖ¸Ïò³£Á¿³ØÖеÄ"abc"¡£ËùÒÔstr1ºÍstr2ÒýÓÃÊÇÏàͬµÄ¡£
µÚ¶þ¸ö¶ÏÑÔÊÇÓÉÓÚ±àÒëÆ÷×öÁËÓÅ»¯£¬±àÒëÆ÷»áÏÈ°Ñ×Ö·û´®Æ´½Ó£¬ÔÙÔÚ³£Á¿³ØÖвéÕÒÕâ¸ö×Ö·û´®ÊÇ·ñ´æÔÚ£¬Èç¹û´æÔÚ£¬ÔòÈñäÁ¿Ö±½ÓÒýÓøÃ×Ö·û´®¡£ËùÒÔstr1ºÍstr3ÒýÓÃÒ²ÊÇÏàͬµÄ¡£
str4µÄ¶ÔÏó²»ÊÇÏÔʽ¸³ÖµµÄ£¬±àÒëÆ÷»áÔÚ¶ÑÖÐÖØзÖÅäÒ»¸öÇøÓòÀ´´æ´¢ËüµÄ¶ÔÏóÊý¾Ý¡£ËùÒÔstr1ºÍstr4µÄÒýÓÃÊDz»Ò»ÑùµÄ¡£
 


Ïà¹ØÎĵµ£º

µ÷ÓÃJava±àÒëÆ÷API±àÒëJavaÔ´´úÂë

Compiling with the Java Compiler API
µ÷ÓÃJava±àÒëÆ÷API±àÒëJava
´ÓµÚÒ»Ì쿪ʼ,±ê×¼Javaƽ̨¾ÍȱÉÙÄܹ»±»µ÷ÓÃ,È¥²úÉúJava×Ö½ÚÂëµÄ±àÒëÆ÷½Ó¿Ú. ʹÓÃSunʵÏÖµÄƽ̨,Ò»¸öÓû§¿ÉÒÔͨ¹ý·Ç±ê×¼µÄ com.sun.tools.javac  °üÖеÄMain class È¥±àÒëÄãµÄ´úÂë (Äã¿ÉÒÔÔÚlib×ÓĿ¼Ï嵀 tools.jar ÎļþÀïÕÒµ½Ëü). È»¶øÕâ¸ö° ......

java web¿ª·¢ÖУ¬ÈçºÎ²é¿´JSPºÍServlet°æ±¾

java web¿ª·¢ÖУ¬ÈçºÎ²é¿´JSPºÍServlet°æ±¾
2008-12-10 09:00
ÎÒÃÇÔÚjava web¿ª·¢µÄ¹ý³ÌÖУ¬ÓÐʱÔÚ×ÊÁÏÉÏ¿ÉÄÜ»áÌáµ½»·¾³ËùÒªÖ§³ÖµÄJSP£¬Servlet°æ±¾¡£Èç¹û°æ±¾µÍ¾Í¿ÉÄܳöÏÖ²âÊÔ´íÎó¡£
·½·¨£º´ò¿ªtomcatµÄcommon\lib Ŀ¼Ï£¬ÓÐÁ½¸öJARÎļþ£º jsp-api.jar servlet-api.jar ¡£Èç¹ûûÓУ¬ÄÇ¿ÉÄÜÊÇÄãûÓÐÌí¼Ó½øÀ´¡£½âѹÕâÁ½¸ ......

¡¾×ª¡¿ÔÚJavaÖÐʹÓÃNIO½øÐÐÍøÂç±à³Ì

ÔÚJDKÖУ¬ÓÐÒ»¸ö·Ç³£ÓÐÒâ˼µÄ¿â£ºNIO£¨New I/O£©¡£Õâ¸ö¿âÖÐÓÐ3¸öÖØÒªµÄÀ࣬·Ö±ðÊÇjava.nio.channelsÖÐSelectorºÍChannel£¬ÒÔ¼°java.nioÖеÄBuffer¡£
±¾ÆªÎÄÕÂÎÒÃÇÊ×ÏÈÁ˽âÒ»ÏÂΪʲôÐèÒªNIOÀ´½øÐÐÍøÂç±à³Ì£¬È»ºó¿´¿´Ò»²½Ò»²½À´½²½âÈçºÎÔÚÍøÂç±à³ÌÖÐʹÓÃNIO¡£
ΪʲôÐèÒªNIO
ʹÓÃJava±àд¹ýSocket³ÌÐòµÄͬѧһ¶¨¶¼ÖªµÀSoc ......

JAVA·´ÉäºÍCLASSÀà


¸ÐлԭÎÄ×÷Õß:http://blog.sina.com.cn/s/blog_62a6ceb10100gwe0.html
 
JAVAÆäʵ²»ËãÊÇÒ»ÃŶ¯Ì¬ÓïÑÔ£¬µ«JAVAÖÐÈ´ÓÖÒ»ÖÖ»úÖÆ¿ÉÒÔ´ïµ½¶¯Ì¬µÄijÖÐЧ¹û£¬Õâ¾ÍÊÇJAVAÖеķ´Éä¡£
     JAVA·´ÉäÖ¸µÄÊÇÎÒÃÇ¿ÉÒÔÓÚÔËÐÐʱ¼ÓÔØ¡¢Ì½Öª¡¢Ê¹ÓñàÒëÆÚ¼äÍêȫδ֪µÄclasses¡£
     ¶¼Ja ......

Javaѧϰ±Ê¼Ç¢Ý JavaÐéÄâ»úµÄ¹¤×÷Ô­Àí £¨Ò»£©

Ò»¡¢Ê²Ã´ÊÇJavaÐéÄâ»ú
     JavaÐéÄâ»úÊÇÒ»¸öÏëÏóÖеĻúÆ÷,ÔÚʵ¼ÊµÄ¼ÆËã»úÉÏͨ¹ýÈí¼þÄ£ÄâÀ´ÊµÏÖ¡£JavaÐéÄâ»úÓÐ×Ô¼ºÏëÏóÖеÄÓ²¼þ,Èç´¦ÀíÆ÷¡¢¶ÑÕ»¡¢¼Ä´æÆ÷µÈ,»¹¾ßÓÐÏàÓ¦µÄÖ¸Áîϵͳ¡£    
¶þ¡¢ÎªÊ²Ã´Ê¹ÓÃJavaÐéÄâ»ú
    JavaÓïÑÔµÄÒ»¸ö·Ç³£ÖØÒªµÄÌصã¾ÍÊÇÓëƽ̨µÄ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ