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

JAVA·´Éä»úÖƼ°CLASS.FORNAMEµÄ×÷Óü°º¬Òå

Reflection ÊÇJava±»ÊÓΪ¶¯Ì¬£¨»ò×¼¶¯Ì¬£©ÓïÑÔµÄÒ»¸ö¹Ø¼üÐÔÖÊ¡£Õâ¸ö»úÖÆÔÊÐí³ÌÐòÔÚÔËÐÐʱ͸¹ýReflection APIsÈ¡µÃÈκÎÒ»¸öÒÑÖªÃû³ÆµÄclass
µÄÄÚ²¿ÐÅÏ¢£¬°üÀ¨Æämodifiers£¨ÖîÈçpublic, static µÈµÈ£©¡¢superclass£¨ÀýÈçObject£©¡¢ÊµÏÖÖ®interfaces£¨ÀýÈçCloneable£©£¬Ò²°üÀ¨fields
ºÍmethodsµÄËùÓÐÐÅÏ¢£¬²¢¿ÉÓÚÔËÐÐʱ¸Ä±äfieldsÄÚÈÝ»ò»½Æðmethods¡£
JavaΪʲôÄܹ»Ö§³ÖReflection£¿´ð°¸ÊÇJavaÔËÐÐʱÈÔȻӵÓÐÀàÐÍÐÅÏ¢£¬Ëü°üº¬ÁËÕâ¸öÀàÒ»ÇУºËüÓÐÄÄЩ×ֶΡ¢ÄÄЩ·½·¨£¬¸÷ÊǺÎÖÖ±£»¤¼¶±ðµÈµÈ£¬»¹ÓÐÕâ¸öÀàÒÀÀµÓÚÄÄЩÀà¡£ÔÚJavaÖУ¬ÀàÐÅÏ¢ÒÔ¶ÔÏóµÄÐÎʽ´æ·Å£¬ÕâЩ¶ÔÏóÊÇÒ»ÖÖÔª¶ÔÏó£¬ËüÃǵÄÀàÐ;ÍÊÇClass¡£ÓµÓÐÁËÕâЩÐÅÏ¢£¬ÎÞÂÛÊǶ¯Ì¬´´½¨¶ÔÏó»¹Êǵ÷ÓÃijЩ·½·¨¶¼ÊÇÇá¶øÒ׾ٵġ£ÔÚC ÖУ¬Í¨¹ýRTTI£¨ÔËÐÐʱÀàÐÍʶ±ð£©£¬ÎÒÃÇÒ²¿ÉÒÔÖªµÀÀàµÄһЩÐÅÏ¢£¬µ«ÎªÊ²Ã´C ÖÐȴûÓÐReflection£¬Ô­ÒòÊÇÀàÐÍÐÅÏ¢²»ÍêÕû¡£RTTIÕâ¸öÃû×Ö±¾Éí¾Í¸æËßÎÒÃÇ£¬C µÄÀàÐÍÐÅÏ¢ÊÇÓÃÀ´½øÐÐÀàÐÍʶ±ðµÄ£¬Òò´Ë£¬ËüÒ²²»ÐèÒªÆäËü¶îÍâµÄÐÅÏ¢¡£²¢²»ÊÇC ÎÞ·¨×öµ½ÕâÒ»µã£¬¶øÊÇC ²»Ï£Íû¸øÓû§Ôö¼Ó¶îÍâµÄ¸ºµ£¡£ÓÐËùµÃ£¬±ØÈ»ÓÐËùʧ£¬Òò´Ë£¬C ·ÅÆúÁËÔª¶ÔÏó¡£¹ØÓÚÕâÒ»µã£¬C Ö®¸¸Bjarne StroustrupÔÚËûµÄ¡¶C ÓïÑÔµÄÉè¼ÆÓëÑÝ»¯¡·µÄ14.2.8½ÚÖнøÐÐÁËÉîÈëµÄÌÖÂÛ¡£
“Class”class
ÖÚËùÖÜÖªJavaÓиöObject class£¬ÊÇËùÓÐJava classesµÄ¼Ì³Ð¸ùÔ´£¬ÆäÄÚÉùÃ÷ÁËÊý¸öÓ¦¸ÃÔÚËù
ÓÐJava classÖб»¸ÄдµÄmethods£ºhashCode()¡¢equals()¡¢clone()¡¢toString()¡¢
getClass()µÈ¡£ÆäÖÐgetClass()·µ»ØÒ»¸öClass object¡£
Class classÊ®·ÖÌØÊâ¡£ËüºÍÒ»°ãclassesÒ»Ñù¼Ì³Ð×ÔObject£¬ÆäʵÌåÓÃÒÔ±í´ïJava³ÌÐòÔËÐÐʱ
µÄclassesºÍinterfaces£¬Ò²ÓÃÀ´±í´ïenum¡¢array¡¢primitive Java types
£¨boolean, byte, char, short, int, long, float, double£©ÒÔ¼°¹Ø¼ü´Êvoid¡£µ±Ò»
¸öclass±»¼ÓÔØ£¬»òµ±¼ÓÔØÆ÷£¨class loader£©µÄdefineClass()±»JVMµ÷Óã¬JVM ±ã×Ô¶¯²ú
ÉúÒ»¸öClass object¡£Èç¹ûÄúÏë½èÓÉ“ÐÞ¸ÄJava±ê×¼¿âÔ´Âë”À´¹Û²ìClass objectµÄʵ¼ÊÉú³É
ʱ»ú£¨ÀýÈçÔÚClassµÄconstructorÄÚÌí¼ÓÒ»¸öprintln()£©£¬²»Äܹ»£¡ÒòΪClass²¢Ã»ÓÐ
public constructor£¨¼ûͼ1£©¡£±¾ÎÄ×îºóÎһᲦһС¿éƪ·ù˳´ø̸̸Java±ê×¼¿âÔ´ÂëµÄ¸Ä¶¯°ì
·¨¡£
ClassÊÇReflection¹ÊÊÂÆðÔ´¡£Õë¶ÔÈκÎÄúÏë̽¿±µÄclass£¬Î¨ÓÐÏÈΪËü²úÉúÒ»¸öClass
object£¬½ÓÏÂÀ´²ÅÄܾ­ÓɺóÕß»½ÆðΪÊýÊ®¶à¸öµÄReflection APIs¡£ÕâЩ


Ïà¹ØÎĵµ£º

Java NIO APIÏê½â

 
Java NIO APIÏê½â
ÔÚJDK
1.4ÒÔÇ°£¬JavaµÄIO²Ù×÷¼¯ÖÐÔÚjava.ioÕâ¸ö°üÖУ¬ÊÇ»ùÓÚÁ÷µÄ×èÈû£¨blocking£©API¡£¶ÔÓÚ´ó¶àÊýÓ¦ÓÃÀ´Ëµ£¬ÕâÑùµÄAPIʹÓúܷ½
±ã£¬È»¶ø£¬Ò»Ð©¶ÔÐÔÄÜÒªÇó½Ï¸ßµÄÓ¦Óã¬ÓÈÆäÊÇ·þÎñ¶ËÓ¦Óã¬ÍùÍùÐèÒªÒ»¸ö¸üΪÓÐЧµÄ·½Ê½À´´¦ÀíIO¡£´ÓJDK 1.4Æð£¬NIO
API×÷Ϊһ¸ö»ùÓÚ»º³åÇø£¬²¢ÄÜÌṩ·Ç×èÈû(non-blo ......

ÓÃjavaʵÏÖµÄÒ»¸ö¼òµ¥web·þÎñÆ÷³ÌÐò

Ò»¡¢Ê×ÏÈÀ´¿´Ò»ÏÂhttpµÄ±¨ÎĽṹ
1¡¢ÇëÇó±¨ÎÄ
Ò»¸öHTTPÇëÇó±¨ÎÄÓÉÇëÇóÐУ¨request line£©¡¢ÇëÇóÍ·²¿£¨header£©¡¢¿ÕÐкÍÇëÇóÊý¾Ý4¸ö²¿·Ö×é³É£¬ÏÂͼ¸ø³öÁËÇëÇó±¨ÎĵÄÒ»°ã¸ñʽ¡£
(1)ÇëÇóÐÐ
ÇëÇóÐÐÓÉÇëÇó·½·¨×ֶΡ¢URL×ֶκÍHTTPЭÒé°æ±¾×Ö¶Î3¸ö×Ö¶Î×é³É£¬ËüÃÇÓÿոñ·Ö¸ô¡£ÀýÈ磬GET /index.html HTTP/1.1¡£
HTTPЭÒéµÄÇëÇ ......

Java 7µÄÖ÷Òª±ä»¯

Devoxx ´ó»á½áÊøÔÚ¼¸ÌìÇ°½áÊøÁË£¬Ò»Î»Óë»áÕ߶Դ˴δó»áµÄÖØÒªÄÚÈݽøÐÐÁË×ܽᣬËûÌáµ½Java 7µÄÖ÷Òª±ä»¯ÈçÏ£º
¡¡¡¡1.¶ÔcollectionsµÄÖ§³Ö
¡¡¡¡Java´úÂë 
List<String> list = new ArrayList<String>();  
list.add("item");  
String item = list.get(0);  
  ......

¶Ôjava¼¼ÊõStringµÄ̽ÌÖ

ÒªÀí½â javaÖÐStringµÄÔË×÷·½Ê½£¬±ØÐëÃ÷È·Ò»µã£ºStringÊÇÒ»¸ö·Ç¿É±äÀࣨimmutable£©¡£Ê²Ã´ÊǷǿɱäÀàÄØ£¿¼òµ¥ËµÀ´£¬·Ç¿É±äÀàµÄʵÀýÊDz»Äܱ»Ð޸ĵģ¬Ã¿¸öʵÀýÖаüº¬µÄÐÅÏ¢¶¼±ØÐëÔÚ¸ÃʵÀý´´½¨µÄʱºò¾ÍÌṩ³öÀ´£¬²¢ÇÒÔÚ¶ÔÏóµÄÕû¸öÉú´æÖÜÆÚÄڹ̶¨²»±ä¡£javaΪʲôҪ°ÑStringÉè¼ÆΪ·Ç¿É±äÀàÄØ£¿Äã¿ÉÒÔÎÊÎÊ james Gosling £º£©¡£µ ......

JavaÖеÄ×Ö·û±àÂëÓë½âÂë(ת)

ת http://jiangzhengjun.javaeye.com/blog/506952
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.Outp ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ