java±ÊÊÔÌâÄ¿¼°´ð°¸ÓÐÄÄЩÄØ£¿ÎÒÃDz»·ÁÒ»ÆðÀ´²Î¿¼Ï·¶ÎÄ°É£¡ÒÔÏÂÊÇС±àΪÄúËѼ¯ÕûÀíÌṩµ½µÄjava±ÊÊÔÌâÄ¿¼°´ð°¸ÄÚÈÝ£¬Ï£Íû¶ÔÄúÓÐËù°ïÖú£¡»¶ÓÔĶÁ²Î¿¼Ñ§Ï°£¡
java±ÊÊÔÌâÄ¿¼°´ð°¸1. ÏÂÃæÄÄЩÊÇThreadÀàµÄ·½·¨()
A start() B run() C exit() D getPriority()
´ð°¸£ºABD
½âÎö£º¿´Java API docs°É£ºhttp://docs.oracle.com/javase/7/docs/api/£¬exit()ÊÇSystemÀàµÄ·½·¨£¬ÈçSystem.exit(0)¡£
2. ÏÂÃæ¹ØÓÚjava.lang.ExceptionÀàµÄ˵·¨ÕýÈ·µÄÊÇ()
A ¼Ì³Ð×ÔThrowable B Serialable CD ²»¼ÇµÃ£¬·´Õý²»ÕýÈ·
´ð°¸£ºA
½âÎö£ºJavaÒì³£µÄ»ùÀàΪjava.lang.Throwable£¬java.lang.ErrorºÍjava.lang.Exception¼Ì³Ð Throwable£¬RuntimeExceptionºÍÆäËüµÄExceptionµÈ¼Ì³ÐException£¬¾ßÌåµÄRuntimeException¼Ì³ÐRuntimeException¡£
À©Õ¹£º´íÎóºÍÒì³£µÄÇø±ð(Error vs Exception)
1) java.lang.Error: ThrowableµÄ×ÓÀ࣬ÓÃÓÚ±ê¼ÇÑÏÖØ´íÎ󡣺ÏÀíµÄÓ¦ÓóÌÐò²»Ó¦¸ÃÈ¥try/catchÕâÖÖ´íÎó¡£¾ø´ó¶àÊýµÄ´íÎó¶¼ÊÇ·ÇÕý³£µÄ£¬¾Í¸ù±¾²»¸Ã³öÏֵġ£
java.lang.Exception: ThrowableµÄ×ÓÀ࣬ÓÃÓÚָʾһÖÖºÏÀíµÄ³ÌÐòÏëÈ¥catchµÄÌõ¼þ¡£¼´Ëü½ö½öÊÇÒ»ÖÖ³ÌÐòÔËÐÐÌõ¼þ£¬¶ø·ÇÑÏÖØ´íÎ󣬲¢ÇÒ¹ÄÀøÓû§³ÌÐòÈ¥catchËü¡£
2) ErrorºÍRuntimeException ¼°Æä×ÓÀ඼ÊÇδ¼ì²éµÄÒì³£(unchecked exceptions)£¬¶øËùÓÐÆäËûµÄExceptionÀ඼ÊǼì²éÁ˵ÄÒì³£(checked exceptions).
checked exceptions: ͨ³£ÊÇ´ÓÒ»¸ö¿ÉÒÔ»Ö¸´µÄ³ÌÐòÖÐÅ׳öÀ´µÄ£¬²¢ÇÒ×îºÃÄܹ»´ÓÕâÖÖÒì³£ÖÐʹÓóÌÐò»Ö¸´¡£±ÈÈçFileNotFoundException, ParseExceptionµÈ¡£¼ì²éÁ˵ÄÒì³£·¢ÉúÔÚ±àÒë½×¶Î£¬±ØÐëҪʹÓÃtry¡catch(»òÕßthrows)·ñÔò±àÒ벻ͨ¹ý¡£
unchecked exceptions: ͨ³£ÊÇÈç¹ûÒ»ÇÐÕý³£µÄ»°±¾²»¸Ã·¢ÉúµÄÒì³££¬µ«ÊǵÄÈ··¢ÉúÁË¡£·¢ÉúÔÚÔËÐÐÆÚ£¬¾ßÓв»È·¶¨ÐÔ£¬Ö÷ÒªÊÇÓÉÓÚ³ÌÐòµÄÂß¼ÎÊÌâËùÒýÆðµÄ¡£±ÈÈçArrayIndexOutOfBoundException, ClassCastExceptionµÈ¡£´ÓÓïÑÔ±¾ÉíµÄ½Ç¶È½²£¬³ÌÐò²»¸ÃÈ¥catchÕâÀàÒì³££¬ËäÈ»Äܹ»´ÓÖîÈçRuntimeExceptionÕâÑùµÄÒì³£ÖÐcatch²¢»Ö¸´£¬µ«ÊDz¢²»¹ÄÀøÖն˳ÌÐòÔ±Õâô×ö£¬ÒòΪÍêȫûҪ±ØÒª¡£ÒòΪÕâÀà´íÎó±¾Éí¾ÍÊÇbug£¬Ó¦¸Ã±»ÐÞ¸´£¬³öÏÖ´ËÀà´íÎóʱ³ÌÐò¾ÍÓ¦¸ÃÁ¢¼´Í£Ö¹Ö´ÐС£ Òò´Ë£¬Ãæ¶ÔErrorsºÍunchecked exceptionsÓ¦¸ÃÈóÌÐò×Ô¶¯ÖÕÖ¹Ö´ÐУ¬³ÌÐòÔ±²»¸Ã×öÖîÈçtry/catchÕâÑùµÄÊÂÇ飬¶øÊÇÓ¦¸Ã²éÃ÷ÔÒò£¬Ð޸ĴúÂëÂß¼¡£
RuntimeException£ºRuntimeExceptionÌåϵ°üÀ¨´íÎóµÄÀàÐÍת»»¡¢Êý×éÔ½½ç·ÃÎʺÍÊÔͼ·ÃÎÊ¿ÕÖ¸ÕëµÈµÈ¡£
´¦ÀíRuntimeExceptionµÄÔÔòÊÇ£ºÈç¹û³öÏÖ RuntimeException£¬ÄÇôһ¶¨ÊdzÌÐòÔ±µÄ´íÎó¡£ÀýÈ磬¿ÉÒÔͨ¹ý¼ì²éÊý×éϱêºÍÊý×é±ß½çÀ´±ÜÃâÊý×éÔ½½ç·ÃÎÊÒì³£¡£ÆäËû(IOExceptionµÈµÈ)checkedÒì³£Ò»°ãÊÇÍⲿ´íÎó£¬ÀýÈçÊÔͼ´ÓÎļþβºó¶ÁÈ¡Êý¾ÝµÈ£¬Õâ²¢²»ÊdzÌÐò±¾ÉíµÄ´íÎ󣬶øÊÇÔÚÓ¦Óû·¾³ÖгöÏÖµÄÍⲿ´íÎó¡£
3. ÏÂÃæ³ÌÐòµÄÔËÐнá¹ûÊÇ()
String str1 = "hello";
String str2 = "he" new String("llo");
System.err.println(str1 == str2);
´ð°¸£ºfalse
½âÎö£ºÒòΪstr2ÖеÄlloÊÇÐÂÉêÇëµÄÄÚ´æ¿é£¬¶ø==ÅжϵÄÊǶÔÏóµÄµØÖ·¶ø·ÇÖµ£¬ËùÒÔ²»Ò»Ñù¡£Èç¹ûÊÇString str2 = str1£¬ÄÇô¾ÍÊÇtrueÁË¡£
4. ÏÂÁÐ˵·¨ÕýÈ·µÄÓÐ()
A. classÖеÄconstructor²»¿ÉÊ¡ÂÔ
B. constructor±ØÐëÓëclassͬÃû£¬µ«·½·¨²»ÄÜÓëclassͬÃû
C. constructorÔÚÒ»¸ö¶ÔÏó±»newʱִÐÐ
D.Ò»¸öclassÖ»Äܶ¨ÒåÒ»¸öconstructor
´ð°¸£ºC
½âÎö£ºÕâÀï¿ÉÄÜ»áÓÐÎóÇø£¬ÆäʵÆÕͨµÄÀà·½·¨ÊÇ¿ÉÒÔºÍÀàÃûͬÃûµÄ£¬ºÍ¹¹Ôì·½·¨Î¨Ò»µÄÇø·Ö¾ÍÊÇ£¬¹¹Ôì·½·¨Ã»Óзµ»ØÖµ¡£
5. ¾ßÌåÑ¡Ïî²»¼ÇµÃ£¬µ«Óõ½µÄ֪ʶÈçÏ£º
String []a = new String[10];
Ôò£ºa[0]~a[9] = null
a.length = 10
Èç¹ûÊÇint []a = new int[10];
Ôò£ºa[0]~a[9] = 0
a.length = 10
6. ÏÂÃæ³ÌÐòµÄÔËÐнá¹û£º()
public static void main(String args[]) {
Thread t = new Thread() {
public void run() {
pong();
}
};
t.run();
System.out.print("ping");
}
static void pong() {
System.out.print("pong");
}
#FormatImgID_0#
A pingpong B pongping C pingpongºÍpongping¶¼ÓпÉÄÜ D ¶¼²»Êä³ö
´ð°¸£ºB
½âÎö£ºÕâÀµÄÊÇThreadÀàÖÐstart()ºÍrun()·½·¨µÄÇø±ðÁË¡£start()ÓÃÀ´Æô¶¯Ò»¸öỊ̈߳¬µ±µ÷ÓÃstart·½·¨ºó£¬ÏµÍ³²Å»á¿ªÆôÒ»¸öеÄỊ̈߳¬½ø¶øµ÷ÓÃrun()·½·¨À´Ö´ÐÐÈÎÎñ£¬¶øµ¥¶ÀµÄµ÷ÓÃrun()¾Í¸úµ÷ÓÃÆÕͨ·½·¨ÊÇÒ»ÑùµÄ£¬ÒѾʧȥÏ̵߳ÄÌØÐÔÁË¡£Òò´ËÔÚÆô¶¯Ò»¸öÏ̵߳ÄʱºòÒ»¶¨ÒªÊ¹ÓÃstart()¶ø²»ÊÇrun()¡£
7. ÏÂÁÐÊôÓÚ¹ØϵÐÍÊý¾Ý¿âµÄÊÇ()
A. Oracle B MySql C IMS D MongoDB
´ð°¸£ºAB
½â´ð£ºIMS(Information Management System )Êý¾Ý¿âÊÇIBM¹«Ë¾¿ª·¢µÄÁ½ÖÖÊý¾Ý¿âÀàÐÍÖ®Ò»;
Ò»ÖÖÊǹØϵÊý¾Ý¿â£¬µäÐÍ´ú±í²úÆ·£ºDB2;
ÁíÒ»ÖÖÔòÊDzã´ÎÊý¾Ý¿â£¬´ú±í²úÆ·£ºIMS²ã´ÎÊý¾Ý¿â¡£
·Ç¹ØϵÐÍÊý¾Ý¿âÓÐMongoDB¡¢memcachedb¡¢RedisµÈ¡£
8. GCÏß³ÌÊÇ·ñΪÊØ»¤Ïß³Ì?()
´ð°¸£ºÊÇ
½âÎö£ºÏ̷߳ÖΪÊØ»¤Ï̺߳ͷÇÊØ»¤Ïß³Ì(¼´Óû§Ïß³Ì)¡£
Ö»Òªµ±Ç°JVMʵÀýÖÐÉдæÔÚÈκÎÒ»¸ö·ÇÊØ»¤Ïß³ÌûÓнáÊø£¬ÊØ»¤Ï߳̾ÍÈ«²¿¹¤×÷;Ö»Óе±×îºóÒ»¸ö·ÇÊØ»¤Ï߳̽áÊøʱ£¬ÊØ»¤Ïß³ÌËæ×ÅJVMһͬ½áÊø¹¤×÷¡£
ÊØ»¤Ïß³Ì×îµäÐ͵ÄÓ¦ÓþÍÊÇ GC (À¬»ø»ØÊÕÆ÷)
9. volatile¹Ø¼ü×ÖÊÇ·ñÄܱ£Ö¤Ḭ̈߳²È«?()
´ð°¸£º²»ÄÜ
½âÎö£ºvolatile¹Ø¼ü×ÖÓÃÔÚ¶àÏß³Ìͬ²½ÖУ¬¿É±£Ö¤¶ÁÈ¡µÄ¿É¼ûÐÔ£¬JVMÖ»ÊDZ£Ö¤´ÓÖ÷ÄÚ´æ¼ÓÔص½Ï̹߳¤×÷ÄÚ´æµÄÖµÊÇ×îеĶÁÈ¡Öµ£¬¶ø·ÇcacheÖС£µ«¶à¸öÏ̶߳Ô
volatileµÄд²Ù×÷£¬ÎÞ·¨±£Ö¤Ḭ̈߳²È«¡£ÀýÈç¼ÙÈçÏß³Ì1£¬Ïß³Ì2 ÔÚ½øÐÐread,load ²Ù×÷ÖУ¬·¢ÏÖÖ÷ÄÚ´æÖÐcountµÄÖµ¶¼ÊÇ5£¬ÄÇô¶¼»á¼ÓÔØÕâ¸ö×îеÄÖµ£¬ÔÚÏß³Ì1¶Ñcount½øÐÐÐÞ¸ÄÖ®ºó£¬»áwriteµ½Ö÷ÄÚ´æÖУ¬Ö÷ÄÚ´æÖеÄcount±äÁ¿¾Í»á±äΪ6;Ïß³Ì2ÓÉÓÚÒѾ½øÐÐread,load²Ù×÷£¬ÔÚ½øÐÐÔËËãÖ®ºó£¬Ò²»á¸üÐÂÖ÷ÄÚ´æcountµÄ±äÁ¿ÖµÎª6;µ¼ÖÂÁ½¸öÏ̼߳°Ê±ÓÃvolatile¹Ø¼ü×ÖÐÞ¸ÄÖ®ºó£¬»¹ÊÇ»á´æÔÚ²¢·¢µÄÇé¿ö¡£
10. ÏÂÁÐ˵·¨ÕýÈ·µÄÊÇ()
A LinkedList¼Ì³Ð×ÔList
B AbstractSet¼Ì³Ð×ÔSet
C HashSet¼Ì³Ð×ÔAbstractSet
D WeakMap¼Ì³Ð×ÔHashMap
´ð°¸£ºAC
½âÎö£ºÏÂÃæÊÇÒ»ÕÅÏÂÔصÄJavaÖеļ¯ºÏÀàÐ͵ļ̳йØϵͼ£¬Ò»Ä¿ÁËÈ»¡£
#FormatImgID_1#
11. ´æÔÚʹi 1 < iµÄÊýÂð()
´ð°¸£º´æÔÚ
½âÎö£ºÈç¹ûiΪintÐÍ£¬ÄÇôµ±iΪintÄܱíʾµÄ×î´óÕûÊýʱ£¬i 1¾ÍÒç³ö±ä³É¸ºÊýÁË£¬´Ëʱ²»¾Í
À©Õ¹£º´æÔÚʹi > j || i <= j²»³ÉÁ¢µÄÊýÂð()
´ð°¸£º´æÔÚ
½âÎö£º±ÈÈçDouble.NaN»òFloat.NaN£¬¸Ðл@BuilderQiuÍøÓÑÖ¸³ö¡£
12. 0.6332µÄÊý¾ÝÀàÐÍÊÇ()
A float B double C Float D Double
´ð°¸£ºB
½âÎö£ºÄ¬ÈÏΪdoubleÐÍ£¬Èç¹ûΪfloatÐÍÐèÒª¼ÓÉÏfÏÔʾ˵Ã÷£¬¼´0.6332f
13. ÏÂÃæÄĸöÁ÷ÀàÊôÓÚÃæÏò×Ö·ûµÄÊäÈëÁ÷( )
A BufferedWriter B FileInputStream C ObjectInputStream D InputStreamReader
´ð°¸£ºD
½âÎö£ºJavaµÄIO²Ù×÷ÖÐÓÐÃæÏò×Ö½Ú(Byte)ºÍÃæÏò×Ö·û(Character)Á½ÖÖ·½Ê½¡£
ÃæÏò×ֽڵIJÙ×÷ΪÒÔ8λΪµ¥Î»¶Ô¶þ½øÖƵÄÊý¾Ý½øÐвÙ×÷£¬¶ÔÊý¾Ý²»½øÐÐת»»£¬ÕâЩÀ඼ÊÇInputStreamºÍOutputStreamµÄ×ÓÀà¡£
ÃæÏò×Ö·ûµÄ²Ù×÷ΪÒÔ×Ö·ûΪµ¥Î»¶ÔÊý¾Ý½øÐвÙ×÷£¬ÔÚ¶ÁµÄʱºò½«¶þ½øÖÆÊý¾ÝתΪ×Ö·û£¬ÔÚдµÄʱºò½«×Ö·ûתΪ¶þ½øÖÆÊý¾Ý£¬ÕâЩÀ඼ÊÇReaderºÍWriterµÄ×ÓÀà¡£
×ܽ᣺ÒÔInputStream(ÊäÈë)/OutputStream(Êä³ö)Ϊºó׺µÄÊÇ×Ö½ÚÁ÷;
ÒÔReader(ÊäÈë)/Writer(Êä³ö)Ϊºó׺µÄÊÇ×Ö·ûÁ÷¡£
14. Java½Ó¿ÚµÄÐÞÊηû¿ÉÒÔΪ()
A private B protected C final D abstract
´ð°¸£ºCD
½âÎö£º½Ó¿ÚºÜÖØÒª£¬ÎªÁË˵Ã÷Çé¿ö£¬ÕâÀïÉÔ΢†ªàµ㣺
(1)½Ó¿ÚÓÃÓÚÃèÊöϵͳ¶ÔÍâÌṩµÄËùÓзþÎñ,Òò´Ë½Ó¿ÚÖеijÉÔ±³£Á¿ºÍ·½·¨¶¼±ØÐëÊǹ«¿ª(public)ÀàÐ͵Ä,È·±£ÍⲿʹÓÃÕßÄÜ·ÃÎÊËüÃÇ;
(2)½Ó¿Ú½ö½öÃèÊöϵͳÄÜ×öʲô,µ«²»Ö¸Ã÷ÈçºÎÈ¥×ö,ËùÒÔ½Ó¿ÚÖеķ½·¨¶¼ÊdzéÏó(abstract)·½·¨;
(3)½Ó¿Ú²»Éæ¼°ºÍÈκξßÌåʵÀýÏà¹ØµÄϸ½Ú,Òò´Ë½Ó¿ÚûÓй¹Ôì·½·¨,²»Äܱ»ÊµÀý»¯,ûÓÐʵÀý±äÁ¿£¬Ö»Óо²Ì¬(static)±äÁ¿;
(4)½Ó¿ÚµÄÖеıäÁ¿ÊÇËùÓÐʵÏÖÀ๲Óеģ¬¼ÈÈ»¹²ÓУ¬¿Ï¶¨ÊDz»±äµÄ¶«Î÷£¬ÒòΪ±ä»¯µÄ¶«Î÷Ò²²»Äܹ»Ëã¹²ÓС£ËùÒÔ±äÁ¿ÊDz»¿É±ä(final)ÀàÐÍ£¬Ò²¾ÍÊdz£Á¿ÁË¡£
(5) ½Ó¿ÚÖв»¿ÉÒÔ¶¨Òå±äÁ¿?Èç¹û½Ó¿Ú¿ÉÒÔ¶¨Òå±äÁ¿£¬µ«ÊǽӿÚÖеķ½·¨ÓÖ¶¼ÊdzéÏóµÄ£¬ÔÚ½Ó¿ÚÖÐÎÞ·¨Í¨¹ýÐÐΪÀ´ÐÞ¸ÄÊôÐÔ¡£ÓеÄÈË»á˵ÁË£¬Ã»ÓйØϵ£¬¿ÉÒÔͨ¹ý ʵÏֽӿڵĶÔÏóµÄÐÐΪÀ´Ð޸ĽӿÚÖеÄÊôÐÔ¡£Õ⵱ȻûÓÐÎÊÌ⣬µ«ÊÇ¿¼ÂÇÕâÑùµÄÇé¿ö¡£Èç¹û½Ó¿Ú A ÖÐÓÐÒ»¸öpublic ·ÃÎÊȨÏ޵ľ²Ì¬±äÁ¿ a¡£°´ÕÕ Java µÄÓïÒ壬ÎÒÃÇ¿ÉÒÔ²»Í¨¹ýʵÏֽӿڵĶÔÏóÀ´·ÃÎʱäÁ¿ a£¬Í¨¹ý A.a = xxx; ¾Í¿ÉÒԸıä½Ó¿ÚÖеıäÁ¿ a µÄÖµÁË¡£ÕýÈç³éÏóÀàÖÐÊÇ¿ÉÒÔÕâÑù×öµÄ£¬ÄÇôʵÏÖ½Ó¿Ú A µÄËùÓжÔÏóÒ²¶¼»á×Ô¶¯ÓµÓÐÕâÒ»¸Ä±äºóµÄ a µÄÖµÁË£¬Ò²¾ÍÊÇ˵һ¸öµØ·½¸Ä±äÁË a£¬ËùÓÐÕâЩ¶ÔÏóÖÐ a µÄÖµÒ²¶¼¸ú×űäÁË¡£ÕâºÍ³éÏóÀàÓÐʲôÇø±ðÄØ£¬ÔõôÌåÏÖ½Ó¿Ú¸ü¸ßµÄ³éÏ󼶱ðÄØ£¬ÔõôÌåÏÖ½Ó¿ÚÌṩµÄͳһµÄÐÒéÄØ£¬ÄÇ»¹Òª½Ó¿ÚÕâÖÖ³éÏóÀ´×öʲôÄØ?ËùÒÔ½Ó¿ÚÖÐ ²»ÄܳöÏÖ±äÁ¿£¬Èç¹ûÓбäÁ¿£¬¾ÍºÍ½Ó¿ÚÌṩµÄͳһµÄ³éÏóÕâÖÖ˼ÏëÊǵִ¥µÄ¡£ËùÒÔ½Ó¿ÚÖеÄÊôÐÔ±ØÈ»Êdz£Á¿£¬Ö»ÄܶÁ²»Äܸģ¬ÕâÑù²ÅÄÜΪʵÏֽӿڵĶÔÏóÌṩһ¸öͳ Ò»µÄÊôÐÔ¡£
ͨË׵Ľ²£¬ÄãÈÏΪÊÇÒª±ä»¯µÄ¶«Î÷£¬¾Í·ÅÔÚÄã×Ô¼ºµÄʵÏÖÖУ¬²»ÄÜ·ÅÔÚ½Ó¿ÚÖÐÈ¥£¬½Ó¿ÚÖ»ÊǶÔÒ»ÀàÊÂÎïµÄÊôÐÔºÍÐÐΪ¸ü¸ß²ã´ÎµÄ³éÏ󡣶ÔÐ޸Ĺرգ¬¶ÔÀ©Õ¹(²»Í¬µÄʵÏÖ implements)¿ª·Å£¬½Ó¿ÚÊǶԿª±ÕÔÔòµÄÒ»ÖÖÌåÏÖ¡£
ËùÒÔ£º
½Ó¿ÚµÄ·½·¨Ä¬ÈÏÊÇpublic abstract;
½Ó¿ÚÖв»¿ÉÒÔ¶¨Òå±äÁ¿¼´Ö»Äܶ¨Òå³£Á¿(¼ÓÉÏfinalÐÞÊξͻá±ä³É³£Á¿)¡£ËùÒÔ½Ó¿ÚµÄÊôÐÔĬÈÏÊÇpublic static final ³£Á¿£¬ÇÒ±ØÐ븳³õÖµ¡£
×¢Ò⣺finalºÍabstract²»ÄÜͬʱ³öÏÖ¡£
15. ²»Í¨¹ý¹¹Ô캯ÊýÒ²ÄÜ´´½¨¶ÔÏóÂð()
A ÊÇ B ·ñ
´ð°¸£ºA
½âÎö£ºJava´´½¨¶ÔÏóµÄ¼¸ÖÖ·½Ê½(ÖØÒª)£º
(1) ÓÃnewÓï¾ä´´½¨¶ÔÏó£¬ÕâÊÇ×î³£¼ûµÄ´´½¨¶ÔÏóµÄ·½·¨¡£
(2) ÔËÓ÷´ÉäÊÖ¶Î,µ÷ÓÃjava.lang.Class»òÕßjava.lang.reflect.ConstructorÀàµÄnewInstance()ʵÀý·½·¨¡£
(3) µ÷ÓöÔÏóµÄclone()·½·¨¡£
(4) ÔËÓ÷´ÐòÁл¯ÊֶΣ¬µ÷ÓÃjava.io.ObjectInputStream¶ÔÏóµÄ readObject()·½·¨¡£
(1)ºÍ(2)¶¼»áÃ÷È·µÄÏÔʽµÄµ÷Óù¹Ô캯Êý ;(3)ÊÇÔÚÄÚ´æÉ϶ÔÒÑÓжÔÏóµÄÓ°Ó¡£¬ËùÒÔ²»»áµ÷Óù¹Ô캯Êý ;(4)ÊÇ´ÓÎļþÖл¹ÔÀàµÄ¶ÔÏó£¬Ò²²»»áµ÷Óù¹Ô캯Êý¡£
×øÍê±ÊÊԺ󣬺ܶàÈ˶¼Ï£ÍûÄÜÌáÇ°Ô¤ÖªÃæÊÔÌâÄ¿£¬×îºÃµÄ·½·¨¾ÍÊÇÕûÀíһЩ¾µäµÄÃæÊÔÌ⣬javaÃæÊÔµÄרҵÐԱȽÏÇ¿£¬Èç¹ûÄãµÄ»ù´¡²»¹»Ôúʵ£¬ÄÇô×îºÃÕÒЩ¾µäµÄjavaÃæÊÔÌâ¼°´ð°¸·ÖÎö£¬ÌáÇ°²Î͸һÏ°É!
javaÃæÊÔÌâ1¡¢ËµËµHashMapºÍHashtableµÄ²î±ð
´ð°¸·ÖÎö£º
¶¼ÊôÓÚMap½Ó¿ÚµÄÀ࣬ʵÏÖÁ˽«Î©Ò»¼üÓ³Éäµ½Ìض¨µÄÖµÉÏ¡£
HashMapÀàûÓзÖÀà»òÅÅÐò¡£ËûÔÊÐíÒ»¸önull¼üºÍ¶à¸önullÖµ¡£
HashtableÀàËÆÓÚHashMap£¬²»¹ý²»ÔÊÐínull¼üºÍnullÖµ¡£ËûÒ²±ÈHashMapÂý£¬ÒòΪËûÊÇͬ²½µÄ¡£
javaÃæÊÔÌâ2¡¢Anonymous Inner Class (ÄäÃûÄÚ²¿Àà)ÊÇ·ñÄÜextends(¼Ì³Ð)ÆäËûÀ࣬ÊÇ·ñimplements(ʵÏÖ)interface(½Ó¿Ú)?
´ð°¸·ÖÎö£º
ÄäÃûµÄÄÚ²¿ÀàÊÇûÓÐÃû×ÖµÄÄÚ²¿Àà¡£²»ÄÜextends(¼Ì³Ð)ÆäËûÀ࣬µ«Ò»¸öÄÚ²¿ÀàÄÜ×÷Ϊһ¸ö½Ó¿Ú£¬ÓÉÁíÒ»¸öÄÚ²¿ÀàʵÏÖ¡£
javaÃæÊÔÌâ3¡¢STRINGÓëSTRINGBUFFERµÄÇø±ðÊÇʲô?
´ð°¸·ÖÎö£º
STRINGµÄ³¤¶ÈÊDz»¿É±äµÄ£¬STRINGBUFFERµÄ³¤¶ÈÊǿɱäµÄ¡£Èç¹ûÄã¶Ô×Ö·û´®ÖеÄÄÚÈݾ³£½øÐвÙ×÷£¬ÌرðÊÇÄÚÈÝÒªÐÞ¸Äʱ£¬ÄÇôʹÓÃStringBuffer£¬Èç¹û×îºóÐèÒªString£¬ÄÇôʹÓÃStringBufferµÄtoString()·½·¨¡£
javaÃæÊÔÌâ4¡¢Ê²Ã´Ê±ºòÓÃassert
´ð°¸·ÖÎö£º
¶ÏÑÔÊǸö°üº¬²¼¶û±í´ïʽµÄÓï¾ä£¬ÔÚÖ´ÐÐÕâ¸öÓï¾äʱ¼Ù¶¨¸Ã±í´ïʽΪtrue¡£Èç¹û±í´ïʽ¼ÆËãΪfalse£¬ÄÇôϵͳ»á±¨¸æÒ»¸öAssertionError£¬ËûÓÃÓÚµ÷ÊÔÄ¿µÄ¡£
javaÃæÊÔÌâ5¡¢SetÀïµÄÔªËØÊDz»ÄÜÖظ´µÄ£¬ÄÇôÓÃʲô·½·¨À´Çø·ÖÖظ´ºÍ·ñÄØ?ÊÇÓÃ==»¹ÊÇequals()?ËûÃÇÓкβî±ð?
´ð°¸·ÖÎö£º
SetÀïµÄÔªËØÊDz»ÄÜÖظ´µÄ£¬ÄÇôÓÃiterator()·½·¨À´Çø·ÖÖظ´ºÍ·ñ¡£equals()ÊÇÅжÁÁ½¸öSetÊÇ·ñÏàµÈ¡£
equals()ºÍ==·½·¨¾ö¶¨ÒýÓÃÖµÊÇ·ñÖ¸Ïòͬһ¶ÔÏóequals()ÔÚÀàÖб»¸²¸Ç£¬ÎªµÄÊǵ±Á½¸ö·ÖÀëµÄ¶ÔÏóµÄÄÚÈݺÍÀàÐÍÏàÅäµÄ»°£¬·µ»ØÕæÖµ¡£
javaÃæÊÔÌâ6¡¢List, Set, MapÊÇ·ñ¼Ì³Ð×ÔCollection½Ó¿Ú?
´ð°¸·ÖÎö£º
List£¬SetÊÇ
Map²»ÊÇ