ÔõôÑùÔÚC/C++Öе÷ÓÃJava
Java¿çƽ̨µÄÌØÐÔʹJavaÔ½À´Ô½ÊÜ¿ª·¢ÈËÔ±µÄ»¶Ó£¬µ«Ò²ÍùÍù»áÌýµ½²»Éٵı§Ô¹£ºÓÃJava¿ª·¢µÄͼÐÎÓû§´°¿Ú½çÃæÿ´ÎÔÚÆô¶¯µÄʱºò¶¼»áÌø³öÒ»¸ö¿ØÖÆ̨´°¿Ú£¬Õâ¸ö¿ØÖÆ̨´°¿ÚÈñ¾À´·Ç³£°ôµÄ½çÃæʧɫ²»ÉÙ¡£ÔõôÄܹ»ÈÃͨ¹ýJava¿ª·¢µÄGUI³ÌÐò²»µ¯³öJavaµÄ¿ØÖÆ̨´°¿ÚÄØ£¿ÆäʵÏÖÔںܶàÁ÷ÐеĿª·¢»·¾³ÀýÈçJBuilder¡¢Eclipse¶¼ÊÇʹÓô¿Java¿ª·¢µÄ¼¯³É»·¾³¡£ÕâЩ¼¯³É»·¾³Æô¶¯µÄʱºò²¢²»»á´ò¿ªÒ»¸öÃüÁî´°¿Ú£¬ÒòΪËüʹÓÃÁËJNI£¨Java Native Interface£©µÄ¼¼Êõ¡£Í¨¹ýÕâÖÖ¼¼Êõ£¬¿ª·¢ÈËÔ±²»Ò»¶¨ÒªÓÃÃüÁîÐÐÀ´Æô¶¯Java³ÌÐò£¬¿ÉÒÔͨ¹ý±àдһ¸ö±¾µØGUI³ÌÐòÖ±½ÓÆô¶¯Java³ÌÐò£¬ÕâÑù¾Í¿É±ÜÃâÁíÍâ´ò¿ªÒ»¸öÃüÁî´°¿Ú£¬Èÿª·¢µÄJava³ÌÐò¸ü¼Óרҵ¡£
JNIÔÊÐíÔËÐÐÔÚÐéÄâ»úµÄJava³ÌÐòÄܹ»ÓëÆäËüÓïÑÔ£¨ÀýÈçCºÍC++£©±àдµÄ³ÌÐò»òÕßÀà¿â½øÐÐÏ໥¼äµÄµ÷Óá£Í¬Ê±JNIÌṩµÄÒ»ÕûÌ×µÄAPI£¬ÔÊÐí½«JavaÐéÄâ»úÖ±½ÓǶÈëµ½±¾µØµÄÓ¦ÓóÌÐòÖС£
±¾ÎĽ«½éÉÜÈçºÎÔÚC/C++Öе÷ÓÃJava·½·¨£¬²¢½áºÏ¿ÉÄÜÉæ¼°µ½µÄÎÊÌâ½éÉÜÕû¸ö¿ª·¢µÄ²½Öè¼°¿ÉÄÜÓöµ½µÄÄÑÌâºÍ½â¾ö·½·¨¡£±¾ÎÄËù²ÉÓõŤ¾ßÊÇSun¹«Ë¾´´½¨µÄ Java Development Kit (JDK) °æ±¾ 1.3.1£¬ÒÔ¼°Î¢Èí¹«Ë¾µÄVisual C++ 6¿ª·¢»·¾³¡£
»·¾³´î½¨
ΪÁËÈñ¾ÎÄÒÔϲ¿·ÖµÄ´úÂëÄܹ»Õý³£¹¤×÷£¬ÎÒÃDZØÐ뽨Á¢Ò»¸öÍêÕûµÄ¿ª·¢»·¾³¡£Ê×ÏÈÐèÒªÏÂÔز¢°²×°JDK 1.3.1£¬ÆäÏÂÔصØַΪ“http://java.sun.com”¡£¼ÙÉ谲װ·¾¶ÎªC£º\JDK¡£ÏÂÒ»²½¾ÍÊÇÉèÖü¯³É¿ª·¢»·¾³£¬Í¨¹ýVisual C++ 6µÄ²Ëµ¥Tools→Options´ò¿ªÑ¡Ïî¶Ô»°¿ò¡£
½«Ä¿Â¼C:\JDK\includeºÍC:\JDK\include\win32¼ÓÈëµ½¿ª·¢»·¾³µÄInclude FilesĿ¼ÖУ¬Í¬Ê±½«C:\JDK\libĿ¼Ìí¼Óµ½¿ª·¢»·¾³µÄLibrary FilesĿ¼ÖС£ÕâÈý¸öĿ¼ÊÇJNI¶¨ÒåµÄһЩ³£Á¿¡¢½á¹¹¼°·½·¨µÄÍ·ÎļþºÍ¿âÎļþ¡£¼¯³É¿ª·¢»·¾³ÒѾÉèÖÃÍê±Ï£¬Í¬Ê±ÎªÁËÖ´ÐгÌÐòÐèÒª°ÑJavaÐéÄâ»úËùÓõ½µÄ¶¯Ì¬Á´½Ó¿âËùÔÚµÄĿ¼C:\JDK \jre\bin\classicÉèÖõ½ÏµÍ³µÄPath»·¾³±äÁ¿ÖС£ÕâÀïÐèÒªÌá³öµÄÊÇ£¬Ä³Ð©¿ª·¢ÈËԱΪÁË·½±ãÖ±½Ó½«JREËùÓõ½µÄDLLÎļþÖ±½Ó¿½±´µ½ÏµÍ³Ä¿Â¼Ï¡£ÕâÑù×öÊDz»Ðеģ¬½«µ¼Ö³õʼ»¯JavaÐéÄâ»ú»·¾³Ê§°Ü£¨·µ»ØÖµ-1£©£¬ÔÒòÊÇJavaÐéÄâ»úÊÇÒÔÏà¶Ô·¾¶À´Ñ°ÕÒËùÓõ½µÄ¿âÎļþºÍÆäËüһЩÏà¹ØÎļþµÄ¡£ÖÁ´ËÕû¸öJNIµÄ¿ª·¢»·¾³ÉèÖÃÍê±Ï£¬ÎªÁËÈô˴ÎJNIÂóÌÄܹ»Ë³Àû½øÐУ¬»¹±ØÐëÏÈ×¼±¸Ò»¸öJavaÀà¡£ÔÚÕâ¸öÀàÖн«Óõ½JavaÖм¸ºõËùÓÐÓдú±íÐÔµÄÊôÐÔ¼°·½·¨£¬È羲̬·½·¨ÓëÊôÐÔ¡¢Êý×é¡¢Òì³£Å׳öÓ벶׽µÈ¡£ÎÒÃǶ¨ÒåµÄJava³ÌÐò(Demo.java)ÈçÏ£¬±¾ÎÄÖÐËùÓеĴúÂëÑÝÊ
Ïà¹ØÎĵµ£º
Ò»¡¢»ù±¾ÖªÊ¶
Ö¸ÕëºÍÒýÓõÄÉùÃ÷·½Ê½£º
ÉùÃ÷Ö¸Õ룺char* pc;
ÉùÃ÷ÒýÓãºchar& rc = 0;
ËüÃǵÄÇø±ð£º
¢Ù´ÓÏÖÏóÉÏ¿´£¬Ö¸ÕëÔÚÔËÐÐʱ¿ÉÒԸıäÆäËùÖ¸ÏòµÄÖµ£¬¶øÒýÓÃÒ»µ©ºÍij¸ö¶ÔÏó°ó¶¨ºó¾Í²»Ôٸı䡣Õâ¾ä»°¿ÉÒÔÀí½âΪ£ºÖ¸Õë¿ÉÒÔ±»ÖØи³ÖµÒÔÖ¸ÏòÁíÒ»¸ö²»Í¬µÄ¶ÔÏó¡£µ«ÊÇÒýÓÃÔò×ÜÊÇÖ¸ÏòÔÚ³õʼ»¯Ê±±»Ö¸¶¨µÄ¶Ô ......
1. ¸ø¶¨µÈʽ A B C D E ÆäÖÐÿ¸ö×Öĸ´ú±íÒ»¸öÊý×Ö£¬ÇÒ²»Í¬Êý×Ö¶ÔÓ¦²»
D F G &nbs ......
C/C++ÖеÄÈÕÆÚºÍʱ¼ä
ͻ񻣼
±¾ÎÄ´Ó½éÉÜ»ù´¡¸ÅÄîÈëÊÖ£¬Ì½ÌÖÁËÔÚC/C++ÖжÔÈÕÆÚºÍʱ¼ä²Ù×÷ËùÓõ½µÄÊý¾Ý½á¹¹ºÍº¯Êý£¬²¢¶Ô¼Æʱ¡¢Ê±¼äµÄ»ñÈ¡¡¢Ê±¼äµÄ¼ÆËãºÍÏÔʾ¸ñʽµÈ·½Ãæ½øÐÐÁ˲ûÊö¡£±¾ÎÄ»¹Í¨¹ý´óÁ¿µÄʵÀýÏòÄãչʾÁËtime.hÍ·ÎļþÖÐÉùÃ÷µÄ¸÷ÖÖº¯ÊýºÍÊý¾Ý½á¹¹µÄÏêϸʹÓ÷½·¨¡£
¹Ø¼ü×Ö£º
UTC£¨ÊÀ½ç±ê׼ʱ¼ä£©£¬Calendar Ti ......
×÷Õߣº
Ôøºê°²£¬»ªÇåÔ¶¼ûǶÈëʽѧԺ
¸ß¼¶½²Ê¦¡£
ÔËËã·ûsizeof¿ÉÒÔ¼ÆËã³ö¸ø¶¨ÀàÐ͵ĴóС£¬¶ÔÓÚ32λϵͳÀ´Ëµ£¬sizeof(char) = 1; sizeof(int) = 4¡£»ù±¾Êý¾ÝÀàÐ͵ĴóСºÜºÃ¼ÆË㣬ÎÒÃÇÀ´¿´Ò»ÏÂÈçºÎ¼ÆËã¹¹ÔìÊý¾ÝÀàÐ͵ĴóС¡£
CÓïÑÔÖеĹ¹ÔìÊý¾ÝÀàÐÍÓÐÈýÖÖ£ºÊý×é¡¢½á¹¹ÌåºÍ¹²ÓÃÌå¡£
Êý×éÊÇÏàͬÀàÐ͵ÄÔªËصļ¯ºÏ£¬Ö»Òª»á¼ÆËã ......
1.½éÉÜÒ»ÏÂSTL£¬Ïêϸ˵Ã÷STLÈçºÎʵÏÖvector.
Answer£º
STL £¨±ê׼ģ°æ¿â£¬Standard Template Library.ËüÓÉÈÝÆ÷Ëã·¨µü´úÆ÷×é³É¡£
STLÓÐÒÔϵÄһЩÓŵ㣺¿ÉÒÔ·½±ãÈÝÒ×µØʵÏÖËÑË÷Êý¾Ý»ò¶ÔÊý¾ÝÅÅÐòµÈһϵÁеÄËã·¨£»µ÷ÊÔ³ÌÐòʱ¸ü¼Ó°²È« ºÍ·½±ã£»¼´Ê¹ÊÇÈËÃÇÓÃSTLÔÚ ......