Effective Java ѧϰ±Ê¼Ç £¨10£©
java.lang.Object ÌṩÁËÒ»¸ötoString()µÄ·½·¨£¬µ«Êµ¼ÊÉÏÕâ¸ö·½·¨·µ»ØµÄÍùÍù²»ÊÇÎÒÃÇÐèÒªµÄ£¬Ëü·µ»ØµÄÊÇÀàÃû¼ÓÉÏ“@”¼ÓÉÏÊ®Áù½øÖƵÄhashÖµ¡£ÕâÏÔÈ»²»ÊÇÎÒÃÇÏëÒªµÄ£¬ËùÒÔ±ØÐëÖØÔØtoStringº¯Êý¡£
ºÜ¼òµ¥µÄÀý×Ó£¬ÈçÏÂ
System.out.println("Failed to connect: " + phoneNumber);
Èç¹û²»ÖØÔØ£¬ÔòÓÐ
Failed to connect: PhoneNumber@12345B
Èç¹ûÖØÔØ£¬ÔòÓÐ
Failed to connect: 0722-90987654
Ч¹ûÊÇÏÔ¶øÒ×¼ûµÄ¡£
ÔÚÖØÔØtoStringʱ£¬ÀàÖÐËùÓеÄÓÐÒâÒå×Ö¶ÎÓ¦¸Ã¶¼ÒªÓÐÊä³ö¡£
Êä³öʱҪÓÐÒ»¶¨ÒªÊÇÈËÀà¿É¶ÁµÄ×Ö·û´®£¬Ò²¿ÉÒÔÊÇÒ»ÖÖ¸ñʽ£¬ÈçXML¡£Èç¹ûÊǸñʽ£¬ÄÇô×îºÃÄÜÓÐÒ»¸ö¾²Ì¬·½·¨º¯ÊýÄܹ»½âÎöÕâÖÖ¸ñʽ²¢×ª»¯¶ÔÏó¡£µ«ÓÐÒ»µãҪעÒ⣬Èç¹ûÄãµÄÀà±»¹ã·ºÊ¹Óã¬ÄÇôÕâЩ¸ñʽ±ã²»ÄÜËæ±ã¸Ä±ä£¬·ñÔò»á¸øʹÓÃÄãµÄÀàµÄÈË´øÀ´ÔÖÄÑ£ºËûÃǵĴúÂë´Ó´ËʧЧ¡£
µ±È»£¬²»¹ÜÊÇ·ñʹÓøñʽ»¯µÄÊä³ö£¬¶¼ÒªÔÚÎĵµÖÐ˵Ã÷ÄãµÄÒâͼ¡£
±¾ÎÄÀ´×ÔCSDN²©¿Í£¬×ªÔØÇë±êÃ÷³ö´¦£ºhttp://blog.csdn.net/mutsinghua/archive/2010/01/28/5266309.aspx
Ïà¹ØÎĵµ£º
ËäÈ»ºÜÉÙÓõ½Í¬²½£¬³öÓÚ¸öÈËÐËȤ×ÔѧÁËһϡ£ÏÖ¶ÔJAVAÖеÄͬ²½ÊÕ¼¯Ñ§Ï°µÄ¶«Î÷×ܽáһϣ¬ÈÃ×Ô¼º¼¼ÊõµÄÌõÀí»¯£¬Äܹ»³ÁµíÏÂÀ´¡£
ͬ²½¾ÍÊÇ´®ÐÐʹÓÃһЩ×ÊÔ´.
JAVAÖÐsynchronized¹Ø¼ü×ÖÄܹ»×÷Ϊº¯ÊýµÄÐÞÊηû£¬Ò²¿É×÷Ϊº¯ÊýÄÚµÄÓï¾ä£¬Ò²¾ÍÊÇƽʱ˵µÄͬ²½·½·¨ºÍͬ²½Óï¾ä¿é¡£¼ÙÈçÔÙϸµÄ·ÖÀ࣬synchronized¿É×÷ÓÃÓÚinstance ......
³¡¾°£ºÏÖÔÚÓиö´ÅÅÌÊä³öµÄÒµÎñ£¬¿Í»§¶ËÐèҪͨ¹ý2¸öÒµÎñ¶ÔÏó½øÐÐÊä³ö¡£
Ò»¸öÊÇͨ¹ýFloppy(ÈíÅÌ)£¬ÁíÒ»¸öÊÇͨ¹ýUSB½Ó¿Ú¡£
ÕâÑù¾ÍÐèÒª2¸öÒµÎñÀ࣬µ«ÊÇÈç¹û²»Èÿͻ§¶ËÖªµÀ¶øʵÏÖ¼òµ¥µÄ×¢ÈëÄØ£¿
Ê×ÏÈ£¬ÓÉÓÚÓÐ2ÖÖÉ豸£¬ÈíÅ̺ÍUSB£¬Òò´ËÎÒÃÇÐèÒª½¨Á¢Ò»¸öÉ豸½Ó¿ÚIDeviceWriter¡£
´úÂëÈçÏ£º ......
ÒÔÏÂÖ»ÊǸöÈËÀí½â
½ñÌìѧϰspringÖеÄÊôÐÔ×¢È룬ÔÚ½²ÔÀíµÄʱºò£¬Ìáµ½ÁËjavaÖеÄÄÚÄÚÊ¡»úÖÆ£¬ÔÚÒÔÇ°Ö»ÊÇÁ˽âһϷ´Éä»úÖÆ¡£
·´Éä»úÖÆÊÇjavaÖеĶ¯Ì¬ÐÔÄÜ£¬¿ÉÒÔÒÔÀàÃûµÃµ½Àà¶ÔÏóµÄ¼¼Êõ£¬ÊµÏÖ¶¯Ì¬Éú³É¶ÔÏó¼¼Êõ£¬¿ÉÒÔÒÔ¶ÔÏóµÃµ½´Ë¶ÔÏóµÄÀàÐÅÏ¢£¨°üÀ¨ÊôÐÔ£¬·½·¨£©£¬ÊµÏִ˼¼ÊõµÄÊÇjavaÖеÄClass¶ÔÏ󣬴˶ÔÏóÊÇÃè ......
Ò»¡¢
ΪʲôҪʹÓÃ
JSP
ÔÚ¿Í»§¶ËÍøÒ³±à³ÌÖÐ
Java
µÄ½â¾ö·½°¸ÊÇ
Servlet/JSP
¡£¶ÔÓÚ¶¯Ì¬Ò³ÃæµÄÐγÉÎÒÃÇ¿ÉÒÔÀûÓÃÔÚ
Servlet
Öбàд×Ö·û´®ÊµÏÖ£¬µ«ÊÇÕâÑù»áʹ³ÌÐòÔ±µÄ¹¤×÷±äµÃÒì³£µÄ·±Ëö£¬ËùÒÔÎÒÃDzÉÓÃ
JSP
´ïµ½ÍøÒ³µÄ¶¯Ì¬ÏÔʾ¡£
¶þ¡¢
ʲôÊÇ
JSP
JSP
£¨
JavaServerPage
£©ºÍ
Servlet
ÊÇ
Java
ÖвúÉú¶¯Ì ......