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

javaÖÐ×Ö·û´®¶ÔÏóµÄ´´½¨¸öÊý

s = new String("xyz");´´½¨Á˼¸¸öString Object?Á½¸ö¶ÔÏó¡£
String s="ÄãºÃ";int i=3; s=i+s; Õâ¸ö±í´ïʽ¶ÔÂð?ÔÚjavaÖлáÌáʾÊý¾ÝÀàÐͲ»Æ¥Åä¡£ÒòΪstringÊÇÀà!ÕýÈ·×ö·¨: s+="3" »òÕß s+='3'»òÕß s+=(char)i;
ÎÒÃÇÒªÒýÈëÁíÍâÒ»ÖÖ´´½¨String¶ÔÏóµÄ·½Ê½µÄÌÖÂÛ——ÒýºÅÄÚ°üº¬Îı¾¡£ÕâÖÖ·½Ê½ÊÇStringÌØÓеģ¬²¢ÇÒËüÓënewµÄ·½Ê½´æÔںܴóÇø±ð¡£
ÔÚJAVAÐéÄâ»ú£¨JVM£©ÖдæÔÚ×ÅÒ»¸ö×Ö·û´®³Ø£¬ÆäÖб£´æןܶàString¶ÔÏ󣬲¢ÇÒ¿ÉÒÔ±»¹²ÏíʹÓã¬Òò´ËËüÌá¸ßÁËЧÂÊ¡£String a="abc";£¬ÕâÐдúÂë±»Ö´ÐеÄʱºò£¬JAVAÐéÄâ»úÊ×ÏÈÔÚ×Ö·û´®³ØÖвéÕÒÊÇ·ñÒѾ­´æÔÚÁËֵΪ"abc"µÄÕâôһ¸ö¶ÔÏó£¬ÅжÏÒÀ¾ÝÊÇStringÀàequals(Object obj)·½·¨µÄ·µ»ØÖµ¡£Èç¹ûÓУ¬Ôò²»ÔÙ´´½¨ÐµĶÔÏó£¬Ö±½Ó·µ»ØÒÑ´æÔÚ¶ÔÏóµÄÒýÓã»Èç¹ûûÓУ¬ÔòÏÈ´´½¨Õâ¸ö¶ÔÏó£¬È»ºó°ÑËü¼ÓÈëµ½×Ö·û´®³ØÖУ¬ÔÙ½«ËüµÄÒýÓ÷µ»Ø¡£
×Ö·û´®¶ÔÏóµÄ´´½¨:ÓÉÓÚ×Ö·û´®¶ÔÏóµÄ´óÁ¿Ê¹ÓÃ[ËüÊÇÒ»¸ö¶ÔÏó£¬Ò»°ã¶øÑÔ¶ÔÏó×ÜÊÇÔÚheap·ÖÅäÄÚ´æ]£¬JavaÖÐΪÁ˽ÚÊ¡ÄÚ´æ¿Õ¼äºÍÔËÐÐʱ¼ä[Èç±È½Ï×Ö·û´®Ê±£¬==±Èequals()¿ì]£¬ÔÚ±àÒë½×¶Î¾Í°ÑËùÓеÄ×Ö·û´®ÎÄ×ַŵ½Ò»¸öÎÄ×Ö³ØÖУ¬¶øÔËÐÐʱÎÄ×ֳسÉΪ³£Á¿³ØµÄÒ»²¿·Ö¡£ÎÄ×ֳصĺô¦£¬¾ÍÊǸóØÖÐËùÓÐÏàͬµÄ×Ö·û´®³£Á¿±»ºÏ²¢£¬Ö»Õ¼ÓÃÒ»¸ö¿Õ¼ä¡£ÎÒÃÇÖªµÀ£¬¶ÔÁ½¸öÒýÓñäÁ¿£¬Ê¹ÓÃ==ÅжÏËüÃǵÄÖµ[ÒýÓÃ]ÊÇ·ñÏàµÈ£¬¼´Ö¸Ïòͬһ¸ö¶ÔÏó£º
    ÏÖÔÚ¿´String s = new String("abc");Óï¾ä£¬ÕâÀï"abc"±¾Éí¾ÍÊÇpoolÖеÄÒ»¸ö¶ÔÏ󣬶øÔÚÔËÐÐʱִÐÐnew String()ʱ£¬½«poolÖеĶÔÏó¸´ÖÆÒ»·Ý·Åµ½heapÖУ¬²¢ÇÒ°ÑheapÖеÄÕâ¸ö¶ÔÏóµÄÒýÓý»¸øs³ÖÓС£ok£¬ÕâÌõÓï¾ä¾Í´´½¨ÁË2¸öString¶ÔÏó¡£
    String s1 = new String("abc") ;String s2 = new String("abc") ;if( s1 == s2 ){ //²»»áÖ´ÐеÄÓï¾ä}
    //´´½¨Á˼¸¸öString Object? [Èý¸ö£¬poolÖÐÒ»¸ö£¬heapÖÐ2¸ö¡£]
Ö»ÓÐʹÓÃÒýºÅ°üº¬Îı¾µÄ·½Ê½´´½¨µÄString¶ÔÏóÖ®¼äʹÓÓ+”Á¬½Ó²úÉúµÄжÔÏó²Å»á±»¼ÓÈë×Ö·û´®³ØÖС£¶ÔÓÚËùÓаüº¬new·½Ê½Ð½¨¶ÔÏ󣨰üÀ¨null£©µÄ“+”Á¬½Ó±í´ïʽ£¬ËüËù²úÉúµÄжÔÏ󶼲»»á±»¼ÓÈë×Ö·û´®³ØÖС£
1.==±íʾÒýÓÃ×Ôͬһ¶ÔÏó£¬equals£¨£©±íʾֵÏàµÈ¡£
String str1 = "abc";ÒýÓõĶÔÏóÔÚÕ»£¨»òÕß½ÐString³Ø£©ÖС£
String str1 =new String ("abc"); ÒýÓõĶÔÏóÔÚÄÚ´æ/¶ÑÖС£
2.String str1 =  "string";ÔÚÕ»ÖÐ
  String str3 =  "str";ÔÚÕ»ÖÐ
&nbs


Ïà¹ØÎĵµ£º

java¶Áдɾ.text,.xmlÎļþÄÚÈÝ

package fileIo;  
 
import  java.io.BufferedReader;  
import  java.io.BufferedWriter;  
import  java.io.File;  
import  java.io.FileReader;  
import  java.io.FileWriter;  
 
 public&nb ......

java ³ÌÐò ´ò°ü ÔËÐÐ


java´ò°ü-exeÎļþ-×îÖÕÒÔsetupÐÎʽ·¢²¼µÄ½â¾öÖ®µÀ
java´ò°ü-exeÎļþ-×îÖÕÒÔsetupÐÎʽ·¢²¼µÄ½â¾öÖ®µÀ   
Ê×ÏÈ£¬½«±àÒëºÃµÄ³ÌÐò´ò°ü³ÉjarÎļþ£¬È»ºó×ö³öexe£¬ÕâÑù´úÂë¾Í²»¿É¼ûÁË£»µ«ÊÇexeÎļþÔÚûÓа²×°jreµÄµçÄÔÉϲ»ÄÜÔËÐУ¬Èç¹ûÒªÇó¿Í»§ÔÙÈ¥°²×°jre ÉèÖû·¾³±äÁ¿ ¾Í²»ÑÅÁË¡£ÎÒÃÇÐèÒª½«jre´ò°ü¡£
Õ⼸²½²Ù×÷Í ......

RedHat AS4ÅäÖÃJava»·¾³

µ½SunÍøÕ¾ÏÂÔØ×Ô½âѹ°²×°°üjdk-xxxx.bin
°²×°£º
[root@RHEL4 JDK-1.5.0.06]# chmod +x jdk-xxxx.bin
[root@RHEL4 JDK-1.5.0.06]# ./jdk-xxxx.bin
Ñ¡Ôñ°²×°Î»Öã¬
J2SDK°²×°Ä¿Â¼£º /usr/local/jdk
ÅäÖÃJava»·¾³±äÁ¿£º
ÔÚ ~/.bash_profile Àï¼ÓÈëÏÂÁм¸Ðл·¾³±äÁ¿¼´¿É£º
export JAVA_HOME=/usr/local/jdk
export PAT ......

java jdbc Á¬½ÓOracle9i

     ×Ô¼ºÔÚ×öÕâ¸ö³ÌÐòµÄʱºò¿´¹ýºÜ¶àµÄ×ÊÁÏ£¬ÉÏÍøÒ²²éÁ˲»ÉÙµÄ×ÊÁÏ£¬¿ÉÊǶà°ë˵µÄÊdzöÉñÈ뻯£¬ÔÆÀïÎíÀï...²»¹â¿´Á˲»Ã÷°×£¬¶øÇÒÊÇÓÐÃ÷°×Ò»µãµÄÈË£¬¿´ÁËÒ²±äµÄÓÐЩģºýÁË¡£
     ÕâÀïÎÒÑÚÊÎÒ»Ì×ÍêÕûµÄjava jdbc Á¬½ÓOracle9iµÄ·¶Àý¡£
package com.lxh.dbcon;//´ò°ü
import ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ