JavaѧϰÐĵã¨×ª×ÔÕŹú±¦£©
1. Êý×éÓÐûÓÐlength()Õâ¸ö·½·¨? StringÓÐûÓÐlength()Õâ¸ö·½·¨£¿
´ð£ºÊý×éûÓÐlength()Õâ¸ö·½·¨£¬ÓÐlengthµÄÊôÐÔ¡£
StringÓÐlength()Õâ¸ö·½·¨¡£
2. String s = new String("xyz");´´½¨Á˼¸¸öString Object?
´ð£ºÁ½¸ö¶ÔÏó£¬Ò»¸öÊÇ“xyx”,Ò»¸öÊÇÖ¸Ïò“xyx”µÄÒýÓöÔÏós¡£
3. abstract classºÍinterfaceÓÐʲôÇø±ð£¿
´ð£ºÉùÃ÷·½·¨µÄ´æÔÚ¶ø²»È¥ÊµÏÖËüµÄÀà±»½Ð×ö³éÏóÀࣨabstract class£©£¬ËüÓÃÓÚÒª´´½¨Ò»¸öÌåÏÖijЩ»ù±¾ÐÐΪµÄÀ࣬²¢Îª¸ÃÀàÉùÃ÷·½·¨£¬µ«²»ÄÜÔÚ¸ÃÀàÖÐʵÏÖ¸ÃÀàµÄÇé¿ö¡£²»ÄÜ´´½¨abstract ÀàµÄʵÀý¡£È»¶ø¿ÉÒÔ´´½¨Ò»¸ö±äÁ¿£¬ÆäÀàÐÍÊÇÒ»¸ö³éÏóÀ࣬²¢ÈÃËüÖ¸Ïò¾ßÌå×ÓÀàµÄÒ»¸öʵÀý¡£²»ÄÜÓгéÏó¹¹Ô캯Êý»ò³éÏó¾²Ì¬·½·¨¡£Abstract ÀàµÄ×ÓÀàΪËüÃǸ¸ÀàÖеÄËùÓгéÏó·½·¨ÌṩʵÏÖ£¬·ñÔòËüÃÇÒ²ÊdzéÏóÀࡣȡ¶ø´úÖ®£¬ÔÚ×ÓÀàÖÐʵÏָ÷½·¨¡£ÖªµÀÆäÐÐΪµÄÆäËüÀà¿ÉÒÔÔÚÀàÖÐʵÏÖÕâЩ·½·¨¡£
½Ó¿Ú£¨interface£©ÊdzéÏóÀàµÄ±äÌå¡£ÔÚ½Ó¿ÚÖУ¬ËùÓз½·¨¶¼ÊdzéÏóµÄ¡£¶à¼Ì³ÐÐÔ¿Éͨ¹ýʵÏÖÕâÑùµÄ½Ó¿Ú¶ø»ñµÃ¡£½Ó¿ÚÖеÄËùÓз½·¨¶¼ÊdzéÏóµÄ£¬Ã»ÓÐÒ»¸öÓгÌÐòÌå¡£½Ó¿ÚÖ»¿ÉÒÔ¶¨Òåstatic final³ÉÔ±±äÁ¿¡£½Ó¿ÚµÄʵÏÖÓë×ÓÀàÏàËÆ£¬³ýÁ˸ÃʵÏÖÀ಻ÄÜ´Ó½Ó¿Ú¶¨ÒåÖм̳ÐÐÐΪ¡£µ±ÀàʵÏÖÌØÊâ½Ó¿Úʱ£¬Ëü¶¨Ò壨¼´½«³ÌÐòÌå¸øÓ裩ËùÓÐÕâÖֽӿڵķ½·¨¡£È»ºó£¬Ëü¿ÉÒÔÔÚʵÏÖÁ˸ýӿڵÄÀàµÄÈκζÔÏóÉϵ÷Óýӿڵķ½·¨¡£ÓÉÓÚÓгéÏóÀ࣬ËüÔÊÐíʹÓýӿÚÃû×÷ΪÒýÓñäÁ¿µÄÀàÐÍ¡£Í¨³£µÄ¶¯Ì¬Áª±à½«ÉúЧ¡£ÒýÓÿÉÒÔת»»µ½½Ó¿ÚÀàÐÍ»ò´Ó½Ó¿ÚÀàÐÍת»»£¬instanceof ÔËËã·û¿ÉÒÔÓÃÀ´¾ö¶¨Ä³¶ÔÏóµÄÀàÊÇ·ñʵÏÖÁ˽ӿÚ.
4. ==ºÍequalsµÄÇø±ð£¿
´ð£º==ÓÃÓÚÅжÏÁ½¸öÒýÓñäÁ¿ÊÇ·ñÖ¸Ïòͬһ¸ö¶ÔÏóʵÀý.
equalsÓÃÓÚÅжÏÁ½¸öÖµÊÇ·ñÏàµÈ.
5. SetÀïµÄÔªËØÊDz»ÄÜÖظ´µÄ£¬ÄÇôÓÃʲô·½·¨À´Çø·ÖÖظ´Óë·ñÄØ? ÊÇÓÃ==»¹ÊÇequals()? ËüÃÇÓкÎÇø±ð?
´ð£ºSetÀïµÄÔªËØÊDz»ÄÜÖظ´µÄ£¬ÄÇôÓÃiterator()·½·¨À´Çø·ÖÖظ´Óë·ñ¡
Ïà¹ØÎĵµ£º
public£¨¹«¹²·ÃÎÊ¿ØÖÆ£©£º¿ÉÒÔ±»ËùÓÐÀà·ÃÎÊ¡£
protected£¨±£»¤·ÃÎÊ¿ØÖÆ£©£º¿ÉÒÔ±»Õâ¸öÀà±¾Éí¡¢ËüµÄ×ÓÀࣨ°üÀ¨Í¬Ò»¸ö°üÖÐÒÔ¼°²»Í¬°üÖеÄ×ÓÀࣩºÍͬһ¸ö°üÖеÄËùÓÐÆäËûÀà·ÃÎÊ¡£
default£¨ÓѺ÷ÃÎÊ¿ØÖÆ£©£º¿ÉÒÔ±»Õâ¸öÀà±¾ÉíºÍͬһ¸ö°üÖеÄÆäËûÀàËù·ÃÎÊ¡£
private£¨Ë½ÓзÃÎÊ¿ØÖÆ£©£ºÖ»Äܱ»¸ÃÀà×ÔÉí·ÃÎʺÍÐ޸ġ£ ......
ºÜ¶àÈËÔÚ³õѧJavaµÄʱºò¾³£»á±»ÊéÖнéÉܵÄÒ»¶Ñ»·¾³±äÁ¿µÄÉèÖøãµÃÍ·»èÄÔÕÍ£¬ºÜ¶àÊéÖж¼»áÔÚ³õ×°JDKµÄʱºòÈÃËû´ó¼ÒÉèÖÃJAVA_HOME»·¾³±ä
Á¿£¬ÔÚ¿ª·¢³ÌÐòµÄʱºòÉèÖÃCLASSPATH»·¾³±äÁ¿£¬¶øºÜ¶àÈ˲¢²»Àí½âÕâÁ½¸ö»·¾³±äÁ¿µÄ×÷Óã¬ÎÒÃÇÀ´·Ö±ð½øÐÐÏêϸµÄ²ûÊö¡£
Ê×ÏÈÊÇJAVA_HOME»·¾³±äÁ¿£¬ÎÒÃÇÏÈÀ´ ......
ÔÚjavaeyeÉÏËѵ½Ò»Æªrobbin¹ØÓÚjavaÐòÁл¯µÄ»Ø¸´£¬ÎÒ¾õµÃÆäÖеÄÀý×ÓºÜÓÐ˵·þÁ¦£¬×ª¹ýÀ´ºÍ´ó¼Ò·ÖÏí¡£
¹ØÓÚ¸ü¶àjavaÐòÁл¯µÄÎÊÌâ¿ÉÒԲμûJAVAϵÁÐÖ®¶ÔÏóµÄÐòÁл¯Óë·´ÐòÁл¯
JavaµÄÐòÁл¯»úÖÆÖ»ÐòÁл¯¶ÔÏóµÄÊôÐÔÖµ£¬¶ø²»»áÈ¥ÐòÁл¯Ê²Ã´ËùνµÄ·½·¨¡£Æä ......
×ÜÖ®£¬ÎÞÂÛÊǽø³ÌµÄ¸ÅÄÊÇÏ̵߳ĸÅÄ¶¼Ê¹±à³Ì´Ó´®Ðбà³Ì£¨ÒÀ´ÎÖ´ÐУ©½øÈëµ½²¢Ðбà³Ì£¨Í¬Ê±Ö´ÐУ©µÄÁìÓò£¬¶øÔÚCPUÄÚ²¿ÊµÏÖµÄÔÀí¶¼ÊÇ°´ÕÕʱ¼äƬ½øÐÐÇл»
2¡¢ ³ä·ÖÀûÓÃϵͳ×ÊÔ´
ͨ¹ýÔÚÒ»¸ö³ÌÐòÄÚ²¿Í¬Ê±Ö´Ðжà¸öÁ÷³Ì£¬¿ÉÒÔ³ä·ÖÀûÓÃCPUµÈϵͳ×ÊÔ´£¬´Ó¶ø×î´óÏ޶ȵķ¢»ÓÓ²¼þµÄÎüÄÜ¡£¾ÍÏñÒ»¸öÈËÍ¬Ê ......
StringBuffer s = “abc”; //¸³ÖµÀàÐͲ»Æ¥Åä
StringBuffer s = (StringBuffer)”abc”; //²»´æÔڼ̳йØϵ£¬ÎÞ·¨½øÐÐǿת
StringBuffer¶ ......