Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JVMÖ¸Áî½âÎöJAVA¶àάÊý×é

ȺÄÚһλÅàѵÀÏʦ·¢³öÀ´Ò»¸öÎÊÌâ:
int[][] a = new int[10][10];
ÕâÖÖ¶àάÊý×é»áÔÚÕ»ÉÏÉú³É¼¸¸ö¶ÔÏó?
Õâ¸öÎÊÌâÐÂÏÊ,ûÈËÎʹý.
·¢³öÀ´ºó ´ó¼Ò¶¼ÈÏΪÓм¸¸öÔªËØ ¾Í»áÉú³É¼¸¸ö¶ÔÏó.
ÎÒ¿ªÊ¼Ò²
ÕâôÈÏΪ.
ÓÚÊÇд¸öÁ˳ÌÐòÊÔÁËÏÂ.·¢ÏÖûÓÐÄÇô¼òµ¥
public static void main(String[] args) {
int[][] a = new int[10][10];
}
¸ù¾ÝclassÉú³ÉJVMÖ¸Áî:
public static void main(java.lang.String[]);
Code:
Stack=2, Locals=2, Args_size=1
0: bipush 10
2: bipush 10
4: multianewarray #2, 2; //class "[[I"
8: astore_1
9: return
LineNumberTable:
line 9: 0
line 25: 9
}
javapÊDz»Æ­È˵Ä.Ã÷Ã÷°×°×µÄд×ÅStack=2,Ò»¿´Õâ½á¹û,²»Ã÷²»°×,ÔÙ×ö¼¸¸öÀý×Ó¿´ÏÂ
public static void main(String[] args) {
int[][][][] a = new int[10][20][30][40];
}
¶ÔÓ¦JVMÔ´Âë:
public static void main(java.lang.String[]);
Code:
Stack=4, Locals=2, Args_size=1
0: bipush 10
2: bipush 20
4: bipush 30
6: bipush 40
8: multianewarray #2, 4; //class "[[[[I"
12: astore_1
13: return
LineNumberTable:
line 9: 0
line 25: 13
}
ÓÖÊÔÁ˼¸¸ö ·¢ÏÖ Êý×éÓм¸Î¬,¾ÍÕ¼Óü¸¸öÕ»
ÔÙÊÔһϸ³ÖµÓë¶ÁÖµ
public static void main(String[] args) {
int[][][][] a = new int[10][20][30][40];
a[9][16][17][18] = 999;
}
¶ÔÓ¦JVMÔ´Âë:
public static void main(java.lang.String[]);
Code:
Stack=4, Locals=2, Args_size=1
0: bipush 10
2: bipush 20
4: bipush 30
6: bipush 40 //ËĸöÖµÈë²Ù×÷ÊýÕ»
8: multianewarray #2, 4; //class "[[[[I"
12: astore_1
13: aload_1 //°Ñ¸Õ²ÅnewµÄÊý×éµÄÄÚ´æµØÖ·ÈëÕ»¶¥
14: bipush 9 //½«Êý×éµÄµÚһάϱê9ÈëÕ»¶¥
16: aaload //¸ù¾ÝÕ»¶¥µÄϱê¶ÁÈ¡µ±Ç°Êý×éµÄÄÚ´æµØÖ·
17: bipush 16
19: aaload
20: bipush 17
22: aaload //¸ù¾ÝÕ»¶¥µÄϱê¶ÁÈ¡µ±Ç°Êý×éµÄÄÚ´æµØÖ·
23: bipush 18 //µÚËÄάϱêÈëÕ»
25: sipush 999 //½«Òª¸³µÄÖµÈëÕ»
28: iastore //½«Öµ ÉèÖýøµ±Ç°Ö¸ÏòµÄÊý×éÄÚ´æµØÖ·
29: return
LineNumberTable:
line 9:


Ïà¹ØÎĵµ£º

JavaÖеĻص÷·½·¨

      ÔÚJavaÖУ¬¾ÍÊÇÀàAµ÷ÓÃÀàBÖеÄij¸ö·½·¨b£¬È»ºóÀàBÓÖÔÚij¸öʱºò·´¹ýÀ´µ÷ÓÃÀàAÖеÄij¸ö·½·¨a£¬¶ÔÓÚAÀ´Ëµ£¬Õâ¸öa·½·¨±ã½Ð×ö»Øµ÷·½·¨,µ±È»£¬AÀàºÍBÀà¿ÉÒԺϲ¢ÎªÒ»¸ö¡£
pubilc interface CallBack{

public void callbackMethod();
}
public class A implements CallBa ......

java»ù´¡×ܽá

¼Ì³Ð(inheritance)
    ¼Ì³ÐÊÇʹÓÃÒÑ´æÔÚµÄÀàµÄ¶¨Òå×÷Ϊ»ù´¡½¨Á¢ÐÂÀàµÄ¼¼Êõ£¬ÐÂÀàµÄ¶¨Òå¿ÉÒÔÔö¼ÓеÄÊý¾Ý»òÐµĹ¦ÄÜ£¬Ò²¿ÉÒÔÓø¸ÀàµÄ¹¦ÄÜ£¬µ«²»ÄÜÑ¡ÔñÐԵؼ̳и¸Àà¡£ÕâÖÖ¼¼ÊõʹµÃ¸´ÓÃÒÔǰµÄ´úÂë·Ç³£ÈÝÒ×£¬Äܹ»´ó´óËõ¶Ì¿ª·¢ÖÜÆÚ£¬½µµÍ¿ª·¢·ÑÓᣱÈÈç¿ÉÒÔÏȶ¨ÒåÒ»¸öÀà½Ð³µ£¬³µÓÐÒÔÏÂÊôÐÔ£º³µÌå´óС£¬ÑÕÉ ......

JavaËã·¨ Ö±½Ó²åÈëÅÅÐò

/**
     * Ö±½Ó²åÈëÅÅÐò,Ê×ÏȱȽÏa[n]Óëa[n-1]£¬ÔڱȽÏa[n]Óëa[n-2]
     * */
    public void sort0(double[] a){
        for(int i = 0; i < a.length -1; i ++){
           ......

javaÏÂClass.forNameµÄ×÷ÓÃÊÇʲô£¬ÎªÊ²Ã´ÒªÊ¹ÓÃËü

Class.forName(xxx.xx.xx) ·µ»ØµÄÊÇÒ»¸öÀà
Ê×ÏÈÄãÒªÃ÷°×ÔÚjavaÀïÃæÈκÎclass¶¼Òª×°ÔØÔÚÐéÄâ»úÉϲÅÄÜÔËÐС£Õâ¾ä»°¾ÍÊÇ×°ÔØÀàÓõÄ(ºÍnew ²»Ò»Ñù£¬Òª·ÖÇå³þ)¡£
ÖÁÓÚʲôʱºòÓã¬Äã¿ÉÒÔ¿¼ÂÇÒ»ÏÂÕâ¸öÎÊÌ⣬¸øÄãÒ»¸ö×Ö·û´®±äÁ¿£¬Ëü´ú±íÒ»¸öÀàµÄ°üÃûºÍÀàÃû£¬ÄãÔõôʵÀý»¯Ëü£¿Ö»ÓÐÄãÌáµ½µÄÕâ¸ö·½·¨ÁË£¬²»¹ýÒªÔÙ¼ÓÒ»µã¡£
A a = ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ