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

Java±à³Ì µÄ¶¯Ì¬ÐÔ£¬µÚ 2²¿·Ö: ÒýÈë·´Éä

·´ÉäʹÄúµÄ³ÌÐò´úÂëÄܹ»½ÓÈë×°Ôص½JVMÖеÄÀàµÄÄÚ²¿ÐÅÏ¢£¬ÔÊÐíÄú±àдÓëÖ´ÐÐʱ£¬¶ø²»ÊÇÔ´´úÂëÖÐÑ¡¶¨µÄÀàЭ×÷µÄ´úÂë¡£Õâʹ·´Éä³É
Ϊ¹¹½¨Áé»îµÄÓ¦ÓõÄÖ÷Òª¹¤¾ß¡£µ«Ðè×¢ÒâµÄÊÇ --Èç¹ûʹÓò»µ±£¬·´ÉäµÄ³É±¾ºÜ¸ß¡£ÔÚJavaƽ̨ϵÁеĵÚ2²¿·ÖÖУ¬Èí¼þ¹ËÎÊDennis
Sosnoski½éÉÜÁËÈçºÎʹÓ÷´É䣬ÒÔ¼°Ä³Ð©Ïà¹ØµÄ³É±¾¡£Äú»¹½«ÕÒµ½JavaReflection APIÈçºÎʹÄúÄܹ»ÔÚÔËÐÐʱ¹ØÁª¶ÔÏó¡£
ÔÚ“
Java±à³ÌµÄ¶¯Ì¬ÐÔ£¬µÚ1²¿·Ö
£¬”ÎÒΪÄú½éÉÜÁËJava±à³ÌÀàºÍÀà×°Èë¡£¸ÃƪÎÄÕ½éÉÜÁËһЩJava¶þ½øÖÆÀà¸ñʽµÄÏà¹ØÐÅÏ¢¡£Õâ¸öÔÂÎÒ½«²ûÊöʹÓÃJava·´ÉäAPIÀ´ÔÚÔËÐÐʱ½ÓÈëºÍʹÓÃһЩÏàͬÐÅÏ¢µÄ»ù´¡¡£ÎªÁËʹÒѾ­ÊìÖª·´Éä»ù´¡µÄ¿ª·¢ÈËÔ±¹Ø×¢±¾ÎÄ£¬ÎÒ½«ÔÚÎÄÕÂÖаüÀ¨·´ÉäÐÔÄÜÈçºÎÓëÖ±½Ó½ÓÈëÏà±È½Ï¡£

ʹÓ÷´É䲻ͬÓÚ³£¹æµÄJava±à³Ì£¬ÆäÖÐËüÓë
ÔªÊý¾Ý
--ÃèÊöÆäËüÊý¾ÝµÄÊý¾ÝЭ×÷¡£JavaÓïÑÔ·´Éä½ÓÈëµÄÌØÊâÀàÐ͵ÄÔ­Êý¾ÝÊÇJVMÖÐÀàºÍ¶ÔÏóµÄÃèÊö¡£·´ÉäʹÄúÄܹ»ÔËÐÐʱ½ÓÈë¹ã·ºµÄÀàÐÅÏ¢¡£ËüÉõÖÁʹÄúÄܹ»¶Áд×Ö¶Î,µ÷ÓÃÔËÐÐʱѡÔñµÄÀàµÄ·½·¨¡£

·´ÉäÊÇÒ»ÖÖÇ¿´óµÄ¹¤¾ß¡£ËüʹÄúÄܹ»´´½¨Áé»îµÄ´úÂ룬ÕâЩ´úÂë¿ÉÒÔÔÚÔËÐÐʱװÅ䣬ÎÞÐèÔÚ×é¼þÖ®¼ä½øÐÐÔ´´ú±íÁ´½Ó¡£µ«·´ÉäµÄijЩ·½Ãæ´æÔÚһЩÒÉÎÊ¡£ÔÚ±¾ÎÄÖУ¬ÎÒ½«ÉîÈëÌÖÂÛΪʲôÄú¿ÉÄÜ
²»
Ï£ÍûÔÚ³ÌÐòÖÐʹÓ÷´É䣬ÒÔ¼°ÄúÓ¦¸ÃÕâÑù×öµÄÀíÓÉ¡£ÔÚÁ˽âÁËȨºâÐÔ·ÖÎöÖ®ºó£¬Äú¿ÉÒÔ×ÔÐоö¶¨ÊÇ·ñÀû´óÓڱס£

³õѧÕßµÄÀà
ʹÓ÷´ÉäµÄÆôµã×ÜÊÇ
java.lang.Class
ʵÀý¡£Èç¹ûÄúÏ£ÍûÓëÔ¤Ïȶ¨ÒåµÄÀàЭ×÷£¬ÄÇôJavaÓïÑÔÌṩһÖÖÖ±½Ó»ñµÃ
Class
ʵÀýµÄ¼ò±ã¿ì½Ý·½Ê½£º

²»Òª´í¹ý±¾ÏµÁеÄÆäËüÎÄÕÂ
µÚ1²¿·Ö£¬“
ÀàºÍÀà×°Èë

(2003Äê4ÔÂ)

Class clas = MyClass.class;
µ±ÄúʹÓÃÕâÒ»Ïî¼¼Êõʱ£¬×°ÈëÀàÉæ¼°µÄËùÓй¤×÷ÔÚÄ»ºó½øÐС£µ«ÊÇ£¬Èç¹ûÄúÐèÒªÔÚÔËÐÐʱ´ÓijЩÍⲿԴ¶ÁÈ¡ÀàÃû£¬ÕâÖÖ·½·¨²¢²»Êʺϡ£Êµ¼ÊÉÏ£¬ÄúÐèҪʹÓÃÒ»¸öÀà×°ÈëÆ÷À´²éÕÒÀàÐÅÏ¢¡£ÒÔϽéÉÜÒ»ÖÖ·½·¨£º
// "name" is the class name to load
Class clas = null;
try {
clas = Class.forName(name);
} catch (ClassNotFoundException ex) {
// handle exception case
}
// use the loaded class
Èç¹ûÒѾ­×°ÈëÁËÀ࣬Äú½«µÃµ½ÏÖÓеÄ
Class
ÐÅÏ¢¡£Èç¹ûÀàδ±»×°È룬Àà×°ÈëÆ÷½«ÏÖÔÚ×°Èë²¢·µ»Øд´½¨µÄÀàʵÀý¡£

»ØÒ³Ê×
»


Ïà¹ØÎĵµ£º

Java Àà×°ÔØÆ÷

 ¹þ¹þ,½ñÌìûÊÂ×ö,µ«ÐÄÇé²»´í,ËùÒÔдÕâƪÎÄÕÂ.
     Àà×°ÔØÆ÷ÊÇJava³ÌÐòÔËÐÐʱ²»¿ÉȱÉÙµÄÒ»²¿·Ö,ËüµÄÈÎÎñÊÇ°ÑÓÉJavaÔ´³ÌÐò±àÒë³ÉµÄclassÎļþ¶ÁÈëµ½ÄÚ´æÖÐ,È·ÇеÄ˵ÊÇ×°Èëµ½JVMµÄÄÚ´æÖÐ,ӦΪJVMÊÇһ̨³éÏóµÄ¼ÆËã»ú,ËüÓÐ×Å×Ô¼ºµÄCPU,ÄÚ´æµÈ. ÔÚclassÎļþÖаüº¬ÁËÒ»¸öÀàµÄ¸÷ÖÖÐÅÏ¢,µ±Ö´ÐÐjava XXXÃü ......

java static µÄʹÓÃ

ÔÚjavaÈç¹ûÒ»¸ö³ÉÔ±±»ÉùÃ÷Ϊstatic£¬Ëü¾ÍÄܹ»ÔÚËüµÄÀàµÄÈκζÔÏó´´½¨Ö®Ç°±»·ÃÎÊ£¬¶ø²»±ØÒýÓÃÈκζÔÏó¡£Äã¿ÉÒÔ½«·½·¨ºÍ±äÁ¿¶¼ÉùÃ÷Ϊstatic¡£static ³ÉÔ±µÄ×î³£¼ûµÄÀý×ÓÊÇmain( ) ¡£ÒòΪÔÚ³ÌÐò¿ªÊ¼Ö´ÐÐʱ±ØÐëµ÷ÓÃmain() £¬ËùÒÔËü±»ÉùÃ÷Ϊstatic¡£ 
ÓÐʱÄãÏ£Íû¶¨ÒåÒ»¸öÀà³ÉÔ±£¬Ê¹ËüµÄʹÓÃÍêÈ«¶ÀÁ¢ÓÚ¸ÃÀàµÄÈκζÔÏó¡£Í¨³ ......

java Éú³Éexcel

    //** **********´´½¨¹¤×÷²¾************ */
            WritableWorkbook workbook = Workbook.createWorkbook(new File("d:/test.xls"));
            /** *//** **********´´½¨¹¤ ......

java»ñÈ¡µ±Ç°Â·¾¶

1¡¢ÀûÓÃSystem.getProperty()º¯Êý»ñÈ¡µ±Ç°Â·¾¶£º 
System.out.println(System.getProperty("user.dir"));//user.dirÖ¸¶¨Á˵±Ç°µÄ·¾¶ 
2¡¢Ê¹ÓÃFileÌṩµÄº¯Êý»ñÈ¡µ±Ç°Â·¾¶£º 
File directory = new File("");//É趨Ϊµ±Ç°Îļþ¼Ð 
try{ 
    System.out.println(directory.get ......

Java ±à³ÌµÄ¶¯Ì¬ÐÔ£¬µÚ 8 ²¿·Ö: ÓôúÂëÉú³ÉÈ¡´ú·´Éä

´Ó±¾ÏµÁÐÇ°ÃæµÄÎÄÕÂÖУ¬ÄúÁ˽⵽·´ÉäµÄÐÔÄܱÈÖ±½Ó·ÃÎÊÒªÂýÐí¶à±¶£¬²¢Á˽âÁËÓà Javassist ºÍ Apache
Byte Code Engineering Library £¨BCEL£©½øÐÐclassworking¡£Java ¹ËÎÊ Dennis
Sosnoski ͨ¹ýÑÝʾÈçºÎʹÓÃÔËÐÐʱ classworking£¬À´ÓÃÈ«ËÙÇ°½øµÄÉú³É´úÂëÈ¡´ú·´Éä´úÂ룬´Ó¶ø½áÊøËûµÄ Java ±à³ÌµÄ¶¯Ì¬ÐÔ
ϵÁС£
¼ÈÈ»ÄúÒѾ­ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ