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

Java newInstance()·½·¨ºÍnew¹Ø¼ü×ÖÇø±ð

ÔÚ³õʼ»¯Ò»¸öÀ࣬Éú³ÉÒ»¸öʵÀýµÄʱºò£¬newInstance()·½·¨ºÍnew¹Ø¼ü×Ö³ýÁËÒ»¸öÊÇ·½·¨£¬Ò»¸öÊǹؼü×ÖÍ⣬×îÖ÷ÒªÓÐʲôÇø±ð£¿ËüÃǵÄÇø±ðÔÚÓÚ´´½¨¶ÔÏóµÄ·½Ê½²»Ò»Ñù£¬Ç°ÕßÊÇʹÓÃÀà¼ÓÔØ»úÖÆ£¬ºóÕßÊÇ´´½¨Ò»¸öÐÂÀà¡£ÄÇôΪʲô»áÓÐÁ½ÖÖ´´½¨¶ÔÏó·½Ê½£¿ÕâÖ÷Òª¿¼Âǵ½Èí¼þµÄ¿ÉÉìËõ¡¢¿ÉÀ©Õ¹ºÍ¿ÉÖØÓõÈÈí¼þÉè¼Æ˼Ïë¡£
    JavaÖй¤³§Ä£Ê½¾­³£Ê¹ÓÃnewInstance()·½·¨À´´´½¨¶ÔÏó£¬Òò´Ë´ÓΪʲôҪʹÓù¤³§Ä£Ê½ÉÏ¿ÉÒÔÕÒµ½¾ßÌå´ð°¸¡£ ÀýÈ磺
    class c = Class.forName(“Example”);
    factory = (ExampleInterface)c.newInstance();
    ÆäÖÐExampleInterfaceÊÇExampleµÄ½Ó¿Ú£¬¿ÉÒÔд³ÉÈçÏÂÐÎʽ£º
    String className = "Example";
    class c = Class.forName(className);
    factory = (ExampleInterface)c.newInstance();
    ½øÒ»²½¿ÉÒÔд³ÉÈçÏÂÐÎʽ£º
    String className = readfromXMlConfig;//´Óxml ÅäÖÃÎļþÖлñµÃ×Ö·û´®
    class c = Class.forName(className);
    factory = (ExampleInterface)c.newInstance();
    ÉÏÃæ´úÂëÒѾ­²»´æÔÚExampleµÄÀàÃû³Æ£¬ËüµÄÓŵãÊÇ£¬ÎÞÂÛExampleÀàÔõô±ä»¯£¬ÉÏÊö´úÂë²»±ä£¬ÉõÖÁ¿ÉÒÔ¸ü»»ExampleµÄÐÖµÜÀàExample2 , Example3 , Example4……£¬Ö»ÒªËûÃǼ̳ÐExampleInterface¾Í¿ÉÒÔ¡£
    ´ÓJVMµÄ½Ç¶È¿´£¬ÎÒÃÇʹÓùؼü×Önew´´½¨Ò»¸öÀàµÄʱºò£¬Õâ¸öÀà¿ÉÒÔûÓб»¼ÓÔØ¡£µ«ÊÇʹÓÃnewInstance()·½·¨µÄʱºò£¬¾Í±ØÐë±£Ö¤£º1¡¢Õâ¸öÀàÒѾ­¼ÓÔØ£»2¡¢Õâ¸öÀàÒѾ­Á¬½ÓÁË¡£¶øÍê³ÉÉÏÃæÁ½¸ö²½ÖèµÄÕýÊÇClassµÄ¾²Ì¬·½·¨forName()ËùÍê³ÉµÄ£¬Õâ¸ö¾²Ì¬·½·¨µ÷ÓÃÁËÆô¶¯Àà¼ÓÔØÆ÷£¬¼´¼ÓÔØjava APIµÄÄǸö¼ÓÔØÆ÷¡£
    ÏÖÔÚ¿ÉÒÔ¿´³ö£¬newInstance()ʵ¼ÊÉÏÊÇ°ÑnewÕâ¸ö·½Ê½·Ö½âΪÁ½²½£¬¼´Ê×Ïȵ÷ÓÃClass¼ÓÔØ·½·¨¼ÓÔØij¸öÀ࣬ȻºóʵÀý»¯¡£ ÕâÑù·Ö²½µÄºÃ´¦ÊÇÏÔ¶øÒ×¼ûµÄ¡£ÎÒÃÇ¿ÉÒÔÔÚµ÷ÓÃclassµÄ¾²Ì¬¼ÓÔØ·½·¨forNameʱ»ñµÃ¸üºÃµÄÁé»îÐÔ£¬Ìṩ¸øÁËÒ»ÖÖ½µñîµÄÊֶΡ£
    ×îºóÓÃ×î¼òµ¥µÄÃèÊöÀ´Çø·Önew¹Ø¼ü×ÖºÍnewInstance()·½·¨µÄÇø±ð£º
    newInstance: ÈõÀàÐÍ¡£µÍЧÂÊ¡£Ö»Äܵ÷ÓÃÎ޲ι¹Ôì¡£
    new: Ç¿ÀàÐÍ¡£Ïà¶Ô¸ßЧ¡£Äܵ÷ÓÃÈκÎpublic¹


Ïà¹ØÎĵµ£º

sql 2005 ´æ´¢¹ý³Ì·ÖÒ³ java ´úÂë

 create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',         
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ ......

java ¾ø¶Ô·¾¶¹¤¾ßÀà

ÔÚ³ÌÖÐÎÒÃdz£È¡Ò»Ð©×ÊÔ´µÄ¾ø¶Ô¾¶£¬ÏÂÃæ¸ø³öÒ»¸ö¼òµ¥·½±ãµÄ¹¤¾ßÀàÀ´°ïÖúÎÒÃÇÇáËɵÄÕÒµ½ÎÒÏëµÄ×ÊÔ´¡££¨ÊÊÓÃÓÚCS/BSÓ¦Óã©
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;

/** *//**
* @author <a href="mailto:maryang@live.cn" mce_hre ......

´«ÖDz¥¿ÍµÄJAVA SE»ù´¡ÊÓƵ 1 5 ×Ôѧ±Ê¼Ç

×òÌìÍíÉÏ¿ªÊ¼Ñ§Ï°´«ÖDz¥¿ÍµÄJAVA SE»ù´¡ÊÓƵ£¬µ½½ñÌìÍíÉÏÒѾ­°Ñ»ù´¡ÊÓƵ1-5¿´ÍêÁË£¬ÒòΪ֮ǰ¶Î¶ÎÐøÐøµÄ×Ôѧ¹ýCºÍJAVA£¬ËùÒÔÇ°ÃæÕ⼸½²¶¼¿´µÃͦ¿ìµÄ£¬µÚ5½²½²¶àỊ̈߳¬¾ÍÓÐЩ¸´ÔÓÁË¡£
2009-12-20  00:08:37
OS»·¾³±äÁ¿£ºOS¶¨ÒåµÄ±äÁ¿£¬¿É±»Ó¦ÓóÌÐòʹÓá£
set£º²é¿´
set path=%path%;....\jdk\bin;    ......

ÿ¸öJava³õѧÕ߶¼Ó¦¸Ã¸ã¶®µÄÁù¸öÎÊÌâ [Java]

¡¡¡¡¶ÔÓÚÕâ¸öϵÁÐÀïµÄÎÊÌ⣬ÿ¸öѧJavaµÄÈ˶¼Ó¦¸Ã¸ã¶®¡£µ±È»£¬Èç¹ûÖ»ÊÇѧJavaÍæÍæ¾ÍÎÞËùνÁË¡£Èç¹ûÄãÈÏΪ×Ô¼ºÒѾ­³¬Ô½³õѧÕßÁË£¬È´²»ºÜ¶®ÕâЩÎÊÌ⣬Ç뽫Äã×Ô¼ºÖعé³õѧÕßÐÐÁС£ÄÚÈݾùÀ´×ÔÓÚCSDNµÄ¾­µäÀÏÌù¡£
¡¡¡¡ÎÊÌâÒ»£ºÎÒÉùÃ÷ÁËʲô£¡
 
String s = "Hello world!";
¡¡¡¡Ðí¶àÈ˶¼×ö¹ýÕâÑùµÄÊÂÇ飬µ«ÊÇ ......

J2SE Java»·¾³±äÁ¿

WindowsÏÂJAVAÓõ½µÄ»·¾³±äÁ¿Ö÷ÒªÓÐ3¸ö£¬JAVA_HOME¡¢CLASSPATH¡¢PATH¡£
JAVA_HOMEÖ¸ÏòµÄÊÇJDKµÄ°²×°Â·¾¶£¬ÈçD:\JDK\jdk1.5.0_12£¬ÔÚÕâ·¾¶ÏÂÄãÓ¦¸ÃÄܹ»ÕÒµ½bin¡¢libµÈĿ¼¡£
JAVA_HOME=D:\JDK\jdk1.5.0_15
PATH»·¾³±äÁ¿Ô­À´WindowsÀïÃæ¾ÍÓУ¬ÄãÖ»ÐèÐÞ¸Äһϣ¬Ê¹ËûÖ¸ÏòJDKµÄbinĿ¼£¬ÕâÑùÄãÔÚ¿ØÖÆ̨ÏÂÃæ±àÒë¡¢Ö´ÐгÌÐòʱ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ