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

java Native Method³õÉæ

 Ò». ʲôÊÇNative Method
   ¼òµ¥µØ½²£¬Ò»¸öNative Method¾ÍÊÇÒ»¸öjavaµ÷Ó÷Çjava´úÂëµÄ½Ó¿Ú¡£Ò»¸öNative MethodÊÇÕâÑùÒ»¸öjavaµÄ·½·¨£º¸Ã·½·¨µÄʵÏÖÓÉ·ÇjavaÓïÑÔʵÏÖ£¬±ÈÈçC¡£Õâ¸öÌØÕ÷²¢·ÇjavaËùÌØÓУ¬ºÜ¶àÆäËüµÄ±à³ÌÓïÑÔ¶¼ÓÐÕâÒ»»úÖÆ£¬±ÈÈçÔÚC£«£«ÖУ¬Äã¿ÉÒÔÓÃextern "C"¸æÖªC£«£«±àÒëÆ÷È¥µ÷ÓÃÒ»¸öCµÄº¯Êý¡£
   "A native method is a Java method whose implementation is provided by non-java code."
   ÔÚ¶¨ÒåÒ»¸önative methodʱ£¬²¢²»ÌṩʵÏÖÌ壨ÓÐЩÏñ¶¨ÒåÒ»¸öjava interface£©£¬ÒòΪÆäʵÏÖÌåÊÇÓÉ·ÇjavaÓïÑÔÔÚÍâÃæʵÏֵġ££¬ÏÂÃæ¸øÁËÒ»¸öʾÀý£º   
    public class IHaveNatives
    {
      native public void Native1( int x ) ;
      native static public long Native2() ;
      native synchronized private float Native3( Object o ) ;
      native void Native4( int[] ary ) throws Exception ;
    }
    ÕâЩ·½·¨µÄÉùÃ÷ÃèÊöÁËһЩ·Çjava´úÂëÔÚÕâЩjava´úÂëÀï¿´ÆðÀ´ÏñʲôÑù×Ó£¨view£©.
    ±êʶ·ûnative¿ÉÒÔÓëËùÓÐÆäËüµÄjava±êʶ·ûÁ¬Ó㬵«ÊÇabstract³ýÍâ¡£ÕâÊǺÏÀíµÄ£¬ÒòΪnative°µÊ¾ÕâЩ·½·¨ÊÇÓÐʵÏÖÌåµÄ£¬Ö»²»¹ýÕâЩʵÏÖÌåÊÇ·ÇjavaµÄ£¬µ«ÊÇabstractÈ´ÏÔÈ»µÄÖ¸Ã÷ÕâЩ·½·¨ÎÞʵÏÖÌå¡£nativeÓëÆäËüjava±êʶ·ûÁ¬ÓÃʱ£¬ÆäÒâÒåͬ·ÇNative Method²¢ÎÞ²î±ð£¬±ÈÈçnative static±íÃ÷Õâ¸ö·½·¨¿ÉÒÔÔÚ²»²úÉúÀàµÄʵÀýʱֱ½Óµ÷Óã¬Õâ·Ç³£·½±ã£¬±ÈÈçµ±ÄãÏëÓÃÒ»¸önative methodÈ¥µ÷ÓÃÒ»¸öCµÄÀà¿âʱ¡£ÉÏÃæµÄµÚÈý¸ö·½·¨Óõ½ÁËnative synchronized£¬JVMÔÚ½øÈëÕâ¸ö·½·¨µÄʵÏÖÌå֮ǰ»áÖ´ÐÐͬ²½Ëø»úÖÆ£¨¾ÍÏñjavaµÄ¶àÏ̡߳££©
    Ò»¸önative method·½·¨¿ÉÒÔ·µ»ØÈκÎjavaÀàÐÍ£¬°üÀ¨·Ç»ù±¾ÀàÐÍ£¬¶øÇÒͬÑù¿ÉÒÔ½øÐÐÒì³£¿ØÖÆ¡£ÕâЩ·½·¨µÄʵÏÖÌå¿ÉÒÔÖÆÒ»¸öÒì³£²¢ÇÒ½«ÆäÅ׳ö£¬ÕâÒ»µãÓëjavaµÄ·½·¨·Ç³£ÏàËÆ¡£µ±Ò»¸önative method½ÓÊÕµ½Ò»Ð©·Ç»ù±¾ÀàÐÍʱÈçObject»òÒ»¸öÕûÐÍÊý×éʱ£¬Õâ¸ö·½·¨¿ÉÒÔ·ÃÎÊÕâ·ÇЩ»ù±¾Ð͵ÄÄÚ²¿£¬µ«ÊÇÕ⽫ʹÕâ¸önative·½·¨ÒÀÀµÓÚÄãËù·ÃÎʵÄjavaÀàµÄʵÏÖ¡£ÓÐÒ»µãÒªÀÎÀμÇס£ºÎÒÃÇ¿ÉÒÔÔÚÒ»¸önative methodµÄ±¾µØʵÏÖÖзÃÎÊËùÓеÄjavaÌØÐÔ£¬µ«ÊÇÕâÒªÒÀÀµÓÚÄãËù·ÃÎʵÄ


Ïà¹ØÎĵµ£º

Java»ù±¾Óï·¨

 finalize·½·¨
ËüÊÇjava.lang.ObjectÀàÖеķ½·¨. ÊÇprotectedµÄ.
ȱʡʱÕâ¸ö·½·¨ÊÇ¿ÕµÄ. JavaÔËÐÐϵͳÔÚÀ¬»ø»ØÊÕʱÔÚ¶ÔÏó±»³·Ïú֮ǰµ÷ÓÃÕâ¸ö·½·¨. µ«ÓÉÓÚÀ¬»øµ¥Ôª
»ØÊÕµÄʱ¼äÊDz»È·¶¨µÄ.ËùÒÔ²»Äܹý·ÖÒÀÀµËü(ÕâºÍc++µÄÎö¹¹º¯Êý²»Í¬). 
¶øÖ»ÄÜÊÇ"ÔÚ¶ÔÏó±»³·Ïú֮ǰ"×öһЩ´¦Àí.ÀýÈç¿ÉÒÔÔÚÕâÀï¹Ø±Õ¹¹Ôì·½·¨Öдò¿ ......

JAVA¼¯ºÏ

Vector : »ùÓÚArrayµÄList£¬Æäʵ¾ÍÊÇ·â×°ÁËArrayËù²»¾ß±¸µÄһЩ¹¦ÄÜ·½±ãÎÒÃÇʹÓã¬Ëü²»¿ÉÄÜ×ßÈëArrayµÄÏÞÖÆ¡£ÐÔÄÜÒ²¾Í²»¿ÉÄÜ
³¬Ô½Array¡£ËùÒÔ£¬ÔÚ¿ÉÄܵÄÇé¿öÏ£¬ÎÒÃÇÒª¶àÔËÓÃArray¡£ÁíÍâºÜÖØÒªµÄÒ»µã¾ÍÊÇVector“sychronized”µÄ£¬Õâ¸öÒ²ÊÇVectorºÍ
ArrayListµÄΨһµÄÇø±ð¡£
ArrayList£ºÍ¬VectorÒ»ÑùÊÇÒ»¸ö»ùÓ ......

javaÀàÐÍѧϰ


Ò»¸öjavaÎļþÖУ¬ÓÐÇÒÖ»ÓÐÒ»¸öpublicÀà
float ff= 1.3f;(4B)
int 4B;
long 8B;
double 8B;
byte Ò»×Ö½ÚÕûÐÍ
char 2B
Êý×é
int num[] = new int[3];
int[] num;
num = new int[3];
int [] num = new int[]{1,2,3};
int [][] num;
num = new int[3][4];
//²»Í¬³¤
num = new int[3][];
num[0] = new int[5]; ......

JAVAѧϰ±Ê¼Ç¢Û

    Alan KayÔø¾­×ܽáÁËSmalltalkµÄÎåÏîÌØÕ÷£¬ÕâЩÌØÕ÷ÊÇJavaËùÒÀÀµµÄ»ù´¡Ö®Ò»£¬µ±È»ÕâЩÌØÕ÷Ò²´ú±íÁ˵ÄÃæÏò¶ÔÏóµÄ±à³ÌµÄ·½·¨¡£
                           &n ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ