²©Ñ§¹È¡ª¡ªÈÃIT½Ìѧ¸ü¼òµ¥£¬ÈÃITѧϰ¸üÓÐЧ
A¡¢·½À¨ºÅ[] B¡¢»¨À¨ºÅ{} C¡¢Ë«ÒýºÅ¡°¡± D¡¢Ô²À¨ºÅ() 2¡¢ÏÂÃæÄÄÒ»¸öÊÇÕýÈ·µÄÀàµÄÉùÃ÷£¿ D A¡¢ public void HH£û¡£ý
B¡¢ public class Move()£û¡£ý
C¡¢ public class void number{} D¡¢ public class Car£û¡£ý
3¡¢ÔÚÒÔÏÂʲôÇé¿öÏ£¬¹¹Ôì·½·¨»á±»µ÷Óã¿B
A¡¢ ÀඨÒåʱ B¡¢ ´´½¨¶ÔÏóʱ C¡¢ µ÷ÓöÔÏó·½·¨Ê± D¡¢ ʹÓöÔÏóµÄ±äÁ¿Ê± 4¡¢ÏÂÃæ¶ÔÓÚ¹¹Ôì·½·¨µÄÃèÊö£¬ÕýÈ·ÓÐÄÄЩ£¿(¶àÑ¡)ABC A¡¢·½·¨Ãû±ØÐëºÍÀàÃûÏàͬ
B¡¢·½·¨ÃûµÄÇ°ÃæûÓзµ»ØÖµÀàÐ͵ÄÉùÃ÷ C¡¢ÔÚ·½·¨Öв»ÄÜʹÓÃreturnÓï¾ä·µ»ØÒ»¸öÖµ
D¡¢µ±¶¨ÒåÁË´ø²ÎÊýµÄ¹¹Ôì·½·¨£¬ÏµÍ³Ä¬ÈϵIJ»´ø²ÎÊýµÄ¹¹Ôì·½·¨ÒÀÈ»´æÔÚ 5¡¢Ê¹ÓÃthisµ÷ÓÃÀàµÄ¹¹Ôì·½·¨£¬ÏÂÃæµÄ˵·¨ÕýÈ·µÄÊÇ£¿(¶àÑ¡)ACD£¨ABCD£© A¡¢Ê¹ÓÃthisµ÷Óù¹Ôì·½·¨µÄ¸ñʽΪthis([²ÎÊý1,²ÎÊý2¡]) B¡¢Ö»ÄÜÔÚ¹¹Ôì·½·¨ÖÐʹÓÃthisµ÷ÓÃÆäËüµÄ¹¹Ôì·½·¨ C¡¢Ê¹ÓÃthisµ÷ÓÃÆäËü¹¹Ôì·½·¨µÄÓï¾ä±ØÐë·ÅÔÚµÚÒ»ÐÐ D¡¢²»ÄÜÔÚÒ»¸öÀàµÄÁ½¸ö¹¹Ôì·½·¨ÖÐʹÓÃthis»¥Ïàµ÷Óà 6¡¢ÏÂÃæÄÄЩ¿ÉÒÔʹÓÃstatic¹Ø¼ü×ÖÐÞÊΣ¿(¶àÑ¡)AC(ACD)
A¡¢ ³ÉÔ±±äÁ¿ B¡¢¾Ö²¿±äÁ¿ C¡¢³ÉÔ±·½·¨ D¡¢³ÉÔ±ÄÚ²¿Àà 7¡¢¹ØÓÚÄÚ²¿À࣬ÏÂÃæ˵·¨ÕýÈ·µÄÊÇ£¿(¶àÑ¡)ACD(ABCD)
A¡¢³ÉÔ±ÄÚ²¿ÀàÊÇÍⲿÀàµÄÒ»¸ö³ÉÔ±£¬¿ÉÒÔ·ÃÎÊÍⲿÀàµÄÆäËü³ÉÔ± B¡¢ÍⲿÀà¿ÉÒÔ·ÃÎʳÉÔ±ÄÚ²¿ÀàµÄ³ÉÔ±
C¡¢·½·¨ÄÚ²¿ÀàÖ»ÄÜÔÚÆ䶨ÒåµÄµ±Ç°·½·¨ÖнøÐÐʵÀý»¯
²©Ñ§¹È¡ª¡ªÈÃIT½Ìѧ¸ü¼òµ¥£¬ÈÃITѧϰ¸üÓÐЧ
D¡¢¾²Ì¬ÄÚ²¿ÀàÖпÉÒÔ¶¨Ò徲̬³ÉÔ±£¬Ò²¿ÉÒÔ¶¨Òå·Ç¾²Ì¬³ÉÔ± 8¡¢ÏÂÃæ¶ÔÓÚµ¥ÀýÉè¼ÆģʽµÄÃèÊö£¬ÕýÈ·µÄÊÇ£¿(¶àÑ¡)BCD(ABCD) A¡¢ÀàÖж¨ÒåÒ»¸öÎ޲εĹ¹Ôì·½·¨£¬²¢ÇÒÉùÃ÷Ϊ˽ÓÐ
B¡¢ÔÚÄÚ²¿´´½¨Ò»¸ö¸ÃÀàµÄʵÀý¶ÔÏó£¬Ê¹Óþ²Ì¬±äÁ¿ÒýÓøÃʵÀý¶ÔÏó C¡¢Ê¹ÓÃprivateÐÞÊξ²Ì¬±äÁ¿£¬½ûÖ¹Íâ½çÖ±½Ó·ÃÎÊ D¡¢¶¨Ò徲̬·½·¨·µ»Ø¸ÃÀàʵÀý 9¡¢ÇëÏÈÔĶÁÏÂÃæµÄ´úÂëD
public class Test { public Test(){
System.out.println(\¹¹Ôì·½·¨Ò»±»µ÷ÓÃÁË\ }
public Test(int x){ this();
System.out.println(\¹¹Ôì·½·¨¶þ±»µ÷ÓÃÁË\ }
public Test(boolean b){ this(1);
System.out.println(\¹¹Ôì·½·¨Èý±»µ÷ÓÃÁË\ }
public static void main(String[] args) { }
}
Test test = new Test(true);
ÉÏÃæ³ÌÐòµÄÔËÐнá¹ûΪÏÂÁÐÄÄÒ»Ï A¡¢¹¹Ôì·½·¨Ò»±»µ÷ÓÃÁË C¡¢¹¹Ôì·½·¨Èý±»µ÷ÓÃÁË
B¡¢¹¹Ôì·½·¨¶þ±»µ÷ÓÃÁË D¡¢ÒÔÉÏÈý¸öÑ¡ÏîÖ®ºÍ
10¡¢OuterÀàÖж¨ÒåÁËÒ»¸ö³ÉÔ±ÄÚ²¿ÀàInner£¬ÐèÒªÔÚmain()·½·¨Öд´½¨InnerÀàʵÀý¶ÔÏó£¬ÒÔÏÂËÄÖÖ·½Ê½ÄÄÒ»ÖÖÊÇÕýÈ·µÄ£¿D
A¡¢ Inner in = new Inner()
B¡¢Inner in = new Outer.Inner();
C¡¢ Outer.Inner in = new Outer.Inner(); D¡¢Outer.Inner in = new Outer().new Inner();
²©Ñ§¹È¡ª¡ªÈÃIT½Ìѧ¸ü¼òµ¥£¬ÈÃITѧϰ¸üÓÐЧ ËÄ¡¢³ÌÐò·ÖÎöÌâ
ÔĶÁÏÂÃæµÄ³ÌÐò£¬·ÖÎö´úÂëÊÇ·ñÄܹ»±àÒëͨ¹ý£¬Èç¹ûÄܱàÒëͨ¹ý£¬ÇëÁгöÔËÐеĽá¹û¡£·ñÔòÇë˵Ã÷±àÒëʧ°ÜµÄÔÒò¡£
´úÂëÒ»£º²»ÄÜ£¬secretÊÇ˽ÓгÉÔ±£¬Ö»ÄÜÀàÄÚ²¿·ÃÎÊ(³ÌÐò²»ÄܱàÒëͨ¹ý£¬ÒòΪÔÚÀàAÖеijÉÔ±±äÁ¿secretÓÃprivateÐÞÊΣ¬ËùÒÔÔÚÀàTest1ÖÐÎÞ·¨·ÃÎÊ)
class A { }
public class Test1 { }
public static void main(String[] args) { }
A a = new A();
System.out.println(a.secret++); private int secret = 5;
´úÂë¶þ£º250(³ÌÐò²»ÄܱàÒëͨ¹ý£¬ÒòΪÔÚ¾²Ì¬·½·¨method()Öв»ÄÜ·ÃÎʷǾ²Ì¬³ÉÔ±±äÁ¿x¡£)
public class Test2 { }
int x = 50;
static int y =200 ;
public static void method() { }
public static void main(String[] args) { }
Test2.method();
System.out.println(x+y);
´úÂëÈý£ºInnerΪ˽ÓÐÄÚ²¿À࣬²»ÔÊÐíÍⲿ·ÃÎÊ(inner)Inner inner = new Outer().new Inner();¿ÉÒÔÓÃÍⲿÀà·ÃÎÊÄÚ²¿Àà
public class Outer {
public String name=\private class Inner { }
public static void main(String[] args) {
String name=\void showName(){ }
System.out.println(name);
²©Ñ§¹È¡ª¡ªÈÃIT½Ìѧ¸ü¼òµ¥£¬ÈÃITѧϰ¸üÓÐЧ
}
}
Inner inner = new Outer().new Inner(); System.out.println(inner.name);
Îå¡¢¼ò´ðÌâ
1¡¢¹¹Ôì·½·¨ºÍÆÕͨµÄ³ÉÔ±·½·¨ÓÐʲôÇø±ð£¿
¹¹Ôì·½·¨ÊÇÀàµÄÒ»¸öÌØÊâ³ÉÔ±£¬Ëü»áÔÚÀàʵÀý»¯¶ÔÏóʱ±»×Ô¶¯µ÷Ó᣶øÆÕͨ·½·¨Ö»ÓÐÔÚʹÓõÄʱºò²Å»á±»µ÷Óá£ÔÚ¶¨Òå¹¹Ôì·½·¨Ê±ÒªÇó·½·¨ÃûÓëÀàÃûÏàͬ¡¢ÔÚ·½·¨ÃûµÄÇ°ÃæûÓзµ»ØÖµÀàÐ͵ÄÉùÃ÷¡¢ÔÚ·½·¨Öв»ÄÜʹÓÃreturnÓï¾ä·µ»ØÒ»¸öÖµ
2¡¢µ¥ÀýÉè¼Æģʽ¾ß±¸ÄÄЩÌص㣿
µ¥Àýģʽ¿ÉÒÔ±£Ö¤ÔÚÕû¸ö³ÌÐòÔËÐÐÆÚ¼äÕë¶Ô¸ÃÀàÖ»´æÔÚÒ»¸öʵÀý¶ÔÏó¡£
Áù¡¢±à³ÌÌâ
1¡¢Çë°´ÕÕÒÔÏÂÒªÇóÉè¼ÆÒ»¸öѧÉúÀàStudent£¬²¢½øÐвâÊÔ¡£ ÒªÇóÈçÏ£º
1£©StudentÀàÖаüº¬ÐÕÃû¡¢³É¼¨Á½¸öÊôÐÔ
2£©·Ö±ð¸øÕâÁ½¸öÊôÐÔ¶¨ÒåÁ½¸ö·½·¨£¬Ò»¸ö·½·¨ÓÃÓÚÉèÖÃÖµ£¬ÁíÒ»¸ö·½·¨ÓÃÓÚ»ñÈ¡Öµ.
3£©StudentÀàÖж¨ÒåÒ»¸öÎ޲εĹ¹Ôì·½·¨ºÍÒ»¸ö½ÓÊÕÁ½¸ö²ÎÊýµÄ¹¹Ôì·½·¨£¬Á½¸ö²ÎÊý·Ö±ðΪÐÕÃûºÍ³É¼¨ÊôÐÔ¸³Öµ
4£©ÔÚ²âÊÔÀàÖд´½¨Á½¸öStudent¶ÔÏó£¬Ò»¸öʹÓÃÎ޲εĹ¹Ôì·½·¨£¬È»ºóµ÷Ó÷½·¨¸øÐÕÃûºÍ³É¼¨¸³Öµ£¬Ò»¸öʹÓÃÓвεĹ¹Ôì·½·¨£¬ÔÚ¹¹Ôì·½·¨ÖиøÐÕÃûºÍ³É¼¨¸³Öµ
2¡¢¶¨ÒåÒ»¸öFatherºÍChildÀ࣬²¢½øÐвâÊÔ¡£
ÒªÇóÈçÏ£º
1£©FatherÀàΪÍⲿÀ࣬ÀàÖж¨ÒåÒ»¸ö˽ÓеÄStringÀàÐ͵ÄÊôÐÔname£¬nameµÄֵΪ¡°zhangjun¡±¡£