JAVA²ÎÊý´«µÝÖµ´«µÝµÄÀí½â¡£
Ê×ÏÈÃ÷ȷһϣºjavaÀïÃæÖ»ÓÐÖµ´«µÝ£¬ÒýÓô«µÝÖ»ÊÇÒ»Ö»Îó¶Á¶øÒÑ¡£
À´¿´Ò»¸öÀý×Ó£º
public static void main(String[] args)
{
StringBuffer str1 = new StringBuffer("hello");
test(str1);
System.out.println("main : " + str1);
}
public static void test(StringBuffer str)
{
StringBuffer tempStr = new StringBuffer();
System.out.println("first : " + str);
str = str.append(" world");
System.out.println("second: " + str);
str = tempStr;
System.out.println("third : " + str);
}
½á¹û
first : hello
second: hello world
third :
main : hello world
Ç°ÃæÈý¸ö´òÓ¡½á¹û¶¼ºÜºÃÀí½â£¬×îºóÒ»¸ömainÀïÃæ´òÓ¡³öµÄΪʲôÊÇ hello worldÄØ£¿
ÈÃÎÒÃÇÒ»²½Ò»²½À´·ÖÎö£º
test(str1);
µ÷ÓÃtest()·½·¨¡£StringBuffer ¶ÔÏó("hello")µÄÒýÓÃ×öΪ²ÎÊý´«¸øtest()·½·¨¡£ÓÐÈ˾ÍÒªÎÊÁË£ºÄãÕâÀï²»¾ÍÊÇ´«µÄÒýÓÃô£¿ÎªÊ²Ã´»¹ËµjavaÀïÃ涼ÊÇÖµ´«µÝÄØ£¿¹Ø¼ü¾ÍÔÚÕâÀÆäʵÕâÀïµÄÖµ´«µÝµÄ'Öµ'µÄÒâ˼ÊÇ----ÒýÓõÄÖµ£¬ÎÒÃÇÖªµÀÒýÓÃÆäʵҲÊÇÒ»¸ö¶ÔÏó£¬ÕâÀï´«µÝµÄ¾ÍÊÇÒýÓõı¾Éí¡£¶ø¶Ô´«µÝµÄÀí½â£¬²¢²»ÊǾÍÊÇ°ÑÕâ¸öÒýÓÃÄùýÈ¥£¬¶øÊǽ«Æ临ÖÆÒ»·Ý£¬½«¸±±¾´«¸øtest()·½·¨¡£ËùÒÔÎÒÃǽøµ½test·½·¨ÀïÃæµÄʱºò£¬strÊÇÒ»¸öеĶ«¶«£¬ËüÓëmainº¯ÊýÀïÃæµÄstr1ͬÑùÖ¸Ïò£¨ºÜ¶àÈ˲»Àí½âÕâ¸öÖ¸Ïòµ½µ×ΪºÎÒ⣬ÎÒÃÇ˵һ¸öÒýÓÃÆäʵҲÊÇÒ»¸ö¶ÔÏó£¬ÄÇôÕâ¸ö¶ÔÏóÀïÃæ°üº¬µÄÄÚÈÝ£¬»òÊÇ˵ËüµÄ²ÎÊý¾ÍÊÇËüËùÖ¸ÏòµÄ¶ÔÏóµÄµØÖ·£©"hello"Õâ¸öStringBuffer¶ÔÏó£¬ÕâÊÇÒ»¸ö¹Ø¼üµã¡£
ÔÙÍùÏ¿´ÎÊÌâ¾ÍÓÈжø½âÁË£¬
str = str.append(" world");
ÓÉÓÚstrͬÑùÒ²ÊÇÖ¸Ïò"hello"¶ÔÏó£¬ËùÒԸòÙ×÷»á¸Ä±ä¶ÔÏó±¾Éí"hello"±ä³É"hello world";
ÔÚÍùÏÂ
str = tempStr;
ÕâÀïҲҪעÒ⣬Õâ¸ö²Ù×÷ºÍ֮ǰµÄÓÐËù²»Í¬£¬Õâ¸öÊÇÒýÓõĸ³ÖµÔËË㣬Ҳ¾ÍÊÇ˵¸Ä±äµÄ¾Í²»ÊÇÒýÓÃÖ¸ÏòµÄ¶ÔÏóÁ˶øÊÇÒýÓñ¾Éí£¬½«tempStrÒýÓõÄÄÚÈݸ³¸østrÒýÓã¬Ò
Ïà¹ØÎĵµ£º
JavaÔ´ÓÚ1991ÄêµÄÒ»¸ö»ú¶¥ºÐÏîÄ¿£¬²¢ÓÉSunÔÚ1995Äê·¢²¼ÁË1.0°æ±¾£¬µ½½ñÌìËãÏÂÀ´£¬Ò²ÒªÓÐ20ÄêµÄʱ¼äÁË¡£JDK1.3-->JDK1.4-->JDK5ÕâÁ½´Î°æ±¾Éý¼¶£¬Ê¹µÃjavaÓïÑԵõ½Á˼«´óµÄÍêÉÆ£¬µ«´ËºóµÄJDK6ºÍÉÐδÕýʽ·¢²¼µÄJDK7£¬²¢Î´¸øÈËÌ«¶àµÄ¾ªÏ²£¬ÖÁÉÙÎÒÊÇÕâÖָоõ¡£Æäʵ´Ó×î½ü¼¸ÄêJVM¼æÈÝÓïÑԵİٻ¨Æë·Å¾Í¿ÉÒÔ¿´³öÀ´¶ËÄߣºJAVAÔ ......
JAVA/JSPÀà±ÏÒµÉè¼Æ
ÈôÓкÏÊÊÄúµÄÉè¼Æ£¬Çë¸æËßÎÒÏêϸ˵Ã÷µÄÍøÖ·£¡Ð»Ð»ºÏ×÷£¡
±àºÅ ÌâÄ¿ ¿ª·¢¹¤¾ß ÄÚÈÝ ×ÊÁÏ·Ñ Ïêϸ˵Ã÷
001JVSQL °ì¹«×Ô¶¯»¯ÏµÍ³ JAVA JAVAÔ´´úÂë+±ÏÒµÂÛÎÄ+¿ªÌⱨ¸æ+´ð±ç¸å £¤180 Ïêϸ˵Ã÷
002JVAC ѧÉúÐÅÏ¢¹ÜÀíϵͳ JAVA JAVAÔ´´úÂë+±ÏÒµÂÛÎÄ+¿ªÌⱨ¸æ+´ð±ç¸å £¤180 Ïêϸ˵Ã÷
004JVAC ͼÊé¹Ý¹ÜÀí ......
UTF8ת»»³ÉGB2312 µ±ÎÒÃÇÔÚ»ùÓÚHTTPÐÒéµÄJSP»òServletµÄÓ¦ÓÃÖлñÈ¡Êý¾Ý»ò·¢ËÍÇëÇóʱ£¬JVM»á°ÑÊäË͵ÄÊý¾Ý±àÂë³ÉUTF8¸ñʽ¡£Èç¹ûÎÒÃÇÖ±½Ó´ÓHTTPÁ÷ÖÐÌáÈ¡ÖÐÎÄÊý¾Ý£¬ÌáÈ¡µÄ½á¹ûΪ“????”£¨¿ÉÄܸü¶àÎʺţ©£¬Îª×ª»»³ÉÎÒÃÇÄܹ»Àí½âµÄÖÐÎÄ×Ö·û£¬ÎÒÃÇÐèÒª°ÑUTF8ת»»³ÉGB2312£¬½èÖúISO-8859-1±ê×¼±àÂëÄܹ»ÇáÒ×µÄʵÏÖ¡£
ºº ......
ÔںܶàÊý¾Ý¿âÖУ¬“ÐÔ±ð”ÕâÒ»×Ö¶ÎÊÇÓÃÓÚintÀàÐÍ´æ´¢µÄ£¬ÈçÓÃ0±íʾ“Å®”£¬1±íʾ“ÄД¡£Ê¹ÓÃResultSet¶ÔÏórs½ÓÊÕ²éѯÊý¾Ý£¬ÔÚ»ñÈ¡Êý¾Ýʱʱ£¬rs.getString()·½·¨ºÍrs.getInt()·½·¨»ñÈ¡µÄÈÔÈ»ÊÇ0(Çø±ðÔÚÓÚStringÀàÐÍ»òÊÇintÀàÐÍ)¡£¶øÔÚʵ¼ÊÓ¦ÓÃʱ£¬ÎÒÃǸüÏ£Íû»ñµÃµÄÊý¾ÝÊÇÖ±¹ÛµØÏÔʾ“ÄÐ ......
java¿ª·¢ÈËÔ±¾Ñé×ܽá-Î人±±´óÇàÄñ
¡¡¡¡·Á¢Ïî
¡¡¡¡Ò»¡¢ÐèÇóµÄÊÕ¼¯£¬UCµÄ±àдËäÈ»²»ÊÇ¿ª·¢ÈËÔ±µÄ¹¤×÷£¬µ«×îÖÕÐèÒª¿ª·¢ÈËÔ±ÔÚ²úÆ·ÖÐʵÏÖ¡£ËùÒÔ¿ª·¢²»ºÏÀíµÄÉè¼ÆÖÁÉÙÀË·ÑÁËÄãµÄʱ¼ä£¬¿ª·¢¼¼ÊõÎÞ·¨ÊµÏÖµÄÉè¼Æ´øÀ´×î´óµÄÍ´¿à£ºÊ§°Ü¡£ËùÒÔ£¬¿ª·¢ÈËÔ±ÒªÖØÊÓÐèÇóÒÔ¼°UCµÄÆÀÉó£¬Ìá³ö×Ô¼ºÄܹ»Ïëµ½µÄËùÓÐÒìÒé¡£
¡¡¡¡¶þ¡¢Ò»¶ ......