¾ÞÈËÍøÂçjava±ÊÊÔ»ù´¡Ìâ·ÖÏí
1¡¢StringÊÇ×î»ù±¾µÄÊý¾ÝÀàÐÍÂð?
»ù±¾Êý¾ÝÀàÐÍ°üÀ¨byte¡¢int¡¢char¡¢long¡¢float¡¢double¡¢booleanºÍshort¡£
java.lang.StringÀàÊÇfinalÀàÐ͵ģ¬Òò´Ë²»¿ÉÒԼ̳ÐÕâ¸öÀà¡¢²»ÄÜÐÞ¸ÄÕâ¸öÀࡣΪÁËÌá¸ßЧÂʽÚÊ¡¿Õ¼ä£¬ÎÒÃÇÓ¦¸ÃÓÃStringBufferÀà
2¡¢int ºÍ Integer ÓÐʲôÇø±ð
Java ÌṩÁ½ÖÖ²»Í¬µÄÀàÐÍ£ºÒýÓÃÀàÐͺÍÔʼÀàÐÍ£¨»òÄÚÖÃÀàÐÍ£©¡£IntÊÇjavaµÄÔʼÊý¾ÝÀàÐÍ£¬IntegerÊÇjavaΪintÌṩµÄ·â×°Àà¡£JavaΪÿ¸öÔʼÀàÐÍÌṩÁË·â×°Àà¡£
ÔʼÀàÐÍ·â×°Àà
booleanBoolean
charCharacter
byteByte
shortShort
intInteger
longLong
floatFloat
doubleDouble
ÒýÓÃÀàÐͺÍÔʼÀàÐ͵ÄÐÐΪÍêÈ«²»Í¬£¬²¢ÇÒËüÃǾßÓв»Í¬µÄÓïÒå¡£ÒýÓÃÀàÐͺÍÔʼÀàÐ;ßÓв»Í¬µÄÌØÕ÷ºÍÓ÷¨£¬ËüÃÇ°üÀ¨£º´óСºÍËÙ¶ÈÎÊÌ⣬ÕâÖÖÀàÐÍÒÔÄÄÖÖÀàÐ͵ÄÊý¾Ý½á¹¹´æ´¢£¬µ±ÒýÓÃÀàÐͺÍÔʼÀàÐÍÓÃ×÷ij¸öÀàµÄʵÀýÊý¾ÝʱËùÖ¸¶¨µÄȱʡֵ¡£¶ÔÏóÒýÓÃʵÀý±äÁ¿µÄȱʡֵΪ null£¬¶øÔʼÀàÐÍʵÀý±äÁ¿µÄȱʡֵÓëËüÃǵÄÀàÐÍÓйء£
3¡¢String ºÍStringBufferµÄÇø±ð
JAVAƽ̨ÌṩÁËÁ½¸öÀࣺStringºÍStringBuffer£¬ËüÃÇ¿ÉÒÔ´¢´æºÍ²Ù×÷×Ö·û´®£¬¼´°üº¬¶à¸ö×Ö·ûµÄ×Ö·ûÊý¾Ý¡£Õâ¸öStringÀàÌṩÁËÊýÖµ²»¿É¸Ä±äµÄ×Ö·û´®¡£¶øÕâ¸öStringBufferÀàÌṩµÄ×Ö·û´®½øÐÐÐ޸ġ£µ±ÄãÖªµÀ×Ö·ûÊý¾ÝÒª¸Ä±äµÄʱºòÄã¾Í¿ÉÒÔʹÓÃStringBuffer¡£µäÐ͵أ¬Äã¿ÉÒÔʹÓÃStringBuffersÀ´¶¯Ì¬¹¹Ôì×Ö·ûÊý¾Ý¡£
4¡¢ÔËÐÐʱÒì³£ÓëÒ»°ãÒì³£ÓкÎÒìͬ£¿
Òì³£±íʾ³ÌÐòÔËÐйý³ÌÖпÉÄܳöÏֵķÇÕý³£×´Ì¬£¬ÔËÐÐʱÒì³£±íʾÐéÄâ»úµÄͨ³£²Ù×÷ÖпÉÄÜÓöµ½µÄÒì³££¬ÊÇÒ»ÖÖ³£¼ûÔËÐдíÎó¡£java±àÒëÆ÷ÒªÇó·½·¨±ØÐëÉùÃ÷Å׳ö¿ÉÄÜ·¢ÉúµÄ·ÇÔËÐÐʱÒì³££¬µ«ÊDz¢²»ÒªÇó±ØÐëÉùÃ÷Å׳öδ±»²¶»ñµÄÔËÐÐʱÒì³£¡£
5¡¢Ëµ³öServletµÄÉúÃüÖÜÆÚ£¬²¢Ëµ³öServletºÍCGIµÄÇø±ð¡£
Servlet±»·þÎñÆ÷ʵÀý»¯ºó£¬ÈÝÆ÷ÔËÐÐÆäinit·½·¨£¬ÇëÇóµ½´ïʱÔËÐÐÆäservice·½·¨£¬service·½·¨×Ô¶¯ÅÉDzÔËÐÐÓëÇëÇó¶ÔÓ¦µÄdoXXX·½·¨£¨doGet£¬doPost£©µÈ£¬µ±·þÎñÆ÷¾ö¶¨½«ÊµÀýÏú»ÙµÄʱºòµ÷ÓÃÆädestroy·½·¨¡£
ÓëcgiµÄÇø±ðÔÚÓÚservlet´¦ÓÚ·þÎñÆ÷½ø³ÌÖУ¬Ëüͨ¹ý¶àÏ̷߳½Ê½ÔËÐÐÆäservice·½·¨£¬Ò»¸öʵÀý¿ÉÒÔ·þÎñÓÚ¶à¸öÇëÇ󣬲¢ÇÒÆäʵÀýÒ»°ã²»»áÏú»Ù£¬¶øCGI¶Ôÿ¸öÇëÇ󶼲úÉúеĽø³Ì£¬·þÎñÍê³Éºó¾ÍÏú»Ù£¬ËùÒÔЧÂÊÉϵÍÓÚservlet¡£
6¡¢Ëµ³öArrayList,Vector, LinkedListµÄ´æ´¢ÐÔÄܺÍÌØÐÔ
ArrayListºÍVector¶¼ÊÇʹÓÃÊý×鷽ʽ´æ´¢Êý¾Ý£¬´ËÊý×éÔªËØÊý´óÓÚʵ¼Ê´æ´¢µÄÊý¾ÝÒÔ±ãÔö¼ÓºÍ²åÈëÔªËØ£¬ËüÃǶ¼ÔÊÐíÖ±½Ó°´ÐòºÅË÷ÒýÔªËØ
Ïà¹ØÎĵµ£º
ÅжÏÌ⣺ÉùÃ÷int a = 10; ÅжÏÒÔÏÂ3¸öÔËËãÊÇ·ñÄܹ»·Ö±ðͨ¹ýJava±àÒëÆ÷£º
a = a/2; a = a/3; a = a*2.89;
½â£ºa = a*2.89;²»ÐУ¬a*2.89ÔËËã»áÌáÉý³ÉdoubleÀàÐÍ
Êý×éÓÐûÓÐlength()Õâ¸ö·½·¨? StringÓÐûÓÐlength()Õâ¸ö·½·¨£¿
½â£ºÊý×éûÓÐlength()Õâ¸ö·½·¨£¬ÓÐlengthµÄÊôÐÔ¡£
¡¡¡¡ StringÓÐÓÐlength()Õ ......
¸ú×ÅÀÏʦѧjavaÕâô¾ÃÁË£¬¶ÔÕâÖÖÕâ¸öÓïÑÔСϺÊÇÕâÑùÀí½âµÄ£¬ËüÊǸöÖÖÉϳ˵ÄÎ书Ãؼ® £¨µ±È»°üÀ¨ÆäËûÓïÑÔ£©£¬Ñ§Ï°Ê±ºÜÈÝÒ××ß»ðÈëħ£¡ÓкܶàjavaµÄ¸ßÊÖ£¬ºÜÀ÷º¦£¡ºÎÒÔ¼ûµÃ£¬ÄãҪʲôʲô¶¼ÄܸøÄãд³öÀ´¶øÇÒÓÃʱ·Ç³£µÄÉÙ£¬Ð¡Ïº²»²Å£¬Ò»Ö±ÒÔÀ´ÐÅ·îÕâÑù²Å½Ð³ÌÐòÔ±£¡ÆäʵСϺÀí½â´í¿©£¬´íÔÚ°ÜÁË£¡Íæ¼¼Êõ£¬Ö»Òª¿¼Ò»¿¼±ãÖªµÀÄãµÄ訮 ......
StringÀàûÓÐÌṩÐÞ¸ÄÒ»¸öÒÑ´æÔÚµÄ×Ö·û´®ÖеÄijһ¸ö×Ö·ûµÄ·½·¨£¬ÀýÈ磺String greeting="Hello";Èç¹ûÏë°Ñgreeting±ä³É"Help!"£¬²»ÄÜÖ±½Ó°ÑgreetingµÄ×îºóһλ±ä³É'p'ºÍ'!'£¬¶øÊDZ£ÁôÐèÒªµÄ×Ö·û´®£¬½«Ìæ»»µÄ×Ö·û´®Í¨¹ý"+"Á¬½ÓÔÚÒ»Æð¡£
greeting=greeting.su ......
Ò»¡¢±ÜÃâÔÚÑ»·Ìõ¼þÖÐʹÓø´ÔÓ±í´ïʽ
ÔÚ²»×ö±àÒëÓÅ»¯µÄÇé¿öÏ£¬ÔÚÑ»·ÖУ¬Ñ»·Ìõ¼þ»á±»·´¸´¼ÆË㣬Èç¹û²»Ê¹Óø´ÔÓ±í´ïʽ£¬¶øʹѻ·Ìõ¼þÖµ²»±äµÄ»°£¬³ÌÐò½«»áÔËÐеĸü¿ì¡£
Àý×Ó£º
import java.util.Vector;
class CEL {
void method (Vector vector) {
......
¶ÔÓÚÕâ¸öϵÁÐÀïµÄÎÊÌ⣬ÿ¸öѧJavaµÄÈ˶¼Ó¦¸Ã¸ã¶®¡£µ±È»£¬Èç¹ûÖ»ÊÇѧJavaÍæÍæ¾ÍÎÞËùνÁË¡£Èç¹ûÄãÈÏΪ×Ô¼ºÒѾ³¬Ô½³õѧÕßÁË£¬È´²»ºÜ¶®ÕâЩÎÊÌ⣬Ç뽫Äã×Ô¼ºÖعé³õѧÕßÐÐÁС£ÄÚÈݾùÀ´×ÔÓÚCSDNµÄ¾µäÀÏÌù¡£Èç¹û´ó¼Ò¸Ð¾õÔÚ»ù´¡Ñ§Ï°×Ô¼º±¡ÈõµÄÒ²¿ÉÒÔÄdzöÀ´¹²Ïí,¹²Í¬Ñ§Ï°.
&nb ......