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()·½·¨À´Çø·ÖÖظ´Óë·ñ¡
Ïà¹ØÎĵµ£º
package org.bupt.test;
import java.util.ArrayList;
class MyResource {
ArrayList<Integer> arrList= new ArrayList<Integer>();
public MyResource(ArrayList<Integer> arrList) {
this.arrList = arrList;
&nbs ......
JavaÀàÖеľ²Ì¬±äÁ¿ÔÚ³ÌÐòÔËÐÐÆڼ䣬ÆäÄÚ´æ¿Õ¼ä¶ÔËùÓиÃÀàµÄ¶ÔÏóʵÀý¶øÑÔÊǹ²ÏíµÄ£¬ÓÐЩʱºò¿ÉÒÔÈÏΪÊÇÈ«¾Ö±äÁ¿¡£Òò´ËÔÚijЩʱºòΪÁ˽ÚʡϵͳÄڴ濪Ïú¡¢¹²Ïí×ÊÔ´£¬¿ÉÒÔ½«ÀàÖеÄһЩ±äÁ¿ÉùÃ÷Ϊ¾²Ì¬±äÁ¿£¬Í¨¹ýÏÂÃæµÄÀý×Ó£¬Äã¿ÉÒÔ·¢ÏÖºÏÀíÓ¦Óþ²Ì¬±äÁ¿´øÀ´µÄºÃ´¦£º
¡¡¡¡Java´úÂë ......
±¾ÈË֮ǰ×öµÄÏîÄ¿ÖлýÀÛ³£ÓõÄʱ¼ä·½·¨£¬Ìù³öÀ´Óë´ó¼Ò¹²Ïí£¬Èç¹ûÄÄÀïÓдíÎó»ò¸üÓÐЧµÄ·½·¨Ç뾡¹ÜÅÄש£¡¹þ¹þ
Java´úÂë
package com.hefeng.test;
import java.text.DateFormat;
import java.text.ParsePosition;
import&n ......
Ò»¡¢static
ÇëÏÈ¿´ÏÂÃæÕâ¶Î³ÌÐò£º
public class Hello{
public static void main(String[] args){//(1)
System.out.println("Hello,world!");//(2)
}
}
¿´¹ýÕâ¶Î³ÌÐò£¬¶ÔÓÚ´ó¶àÊýѧ¹ýJava µÄ´ÓÀ´Ëµ£¬¶¼²»Ä°Éú¡£¼´Ê¹Ã»ÓÐѧ¹ýJava£¬¶øѧ¹ýÆäËüµÄ¸ß¼¶ÓïÑÔ£¬ÀýÈçC£¬ÄÇÄúÒ²Ó¦¸ÃÄÜ¿´¶®Õâ¶Î´úÂëµÄÒâ˼¡£ËüÖ»ÊǼòµ ......