Java·´Éä»úÖÆ
Ò»¡¢Ê²Ã´ÊÇ·´É䣺
·´ÉäµÄ¸ÅÄîÊÇÓÉSmithÔÚ1982ÄêÊ×´ÎÌá³öµÄ£¬Ö÷ÒªÊÇÖ¸³ÌÐò¿ÉÒÔ·ÃÎÊ¡¢¼ì²âºÍÐÞ¸ÄËü±¾Éí״̬»òÐÐΪµÄÒ»ÖÖÄÜÁ¦¡£ÕâÒ»¸ÅÄîµÄÌá³öºÜ¿ìÒý·¢Á˼ÆËã»ú¿ÆѧÁìÓò¹ØÓÚÓ¦Ó÷´ÉäÐÔµÄÑо¿¡£ËüÊ×Ïȱ»³ÌÐòÓïÑÔµÄÉè¼ÆÁìÓòËù²ÉÓÃ,²¢ÔÚLispºÍÃæÏò¶ÔÏó·½ÃæÈ¡µÃÁ˳ɼ¨¡£ÆäÖÐLEAD/LEAD++ ¡¢OpenC++ ¡¢MetaXaºÍOpenJavaµÈ¾ÍÊÇ»ùÓÚ·´Éä»úÖƵÄÓïÑÔ¡£×î½ü£¬·´Éä»úÖÆÒ²±»Ó¦Óõ½ÁËÊÓ´°ÏµÍ³¡¢²Ù×÷ϵͳºÍÎļþϵͳÖС£
·´Éä±¾Éí²¢²»ÊÇÒ»¸öиÅÄ¾¡¹Ü¼ÆËã»ú¿Æѧ¸³ÓèÁË·´Éä¸ÅÄîеĺ¬Òå¡£ÔÚ¼ÆËã»ú¿ÆѧÁìÓò£¬·´ÉäÊÇÖ¸Ò»ÀàÓ¦Óã¬ËüÃÇÄܹ»×ÔÃèÊöºÍ×Ô¿ØÖÆ¡£Ò²¾ÍÊÇ˵£¬ÕâÀàÓ¦ÓÃͨ¹ý²ÉÓÃijÖÖ»úÖÆÀ´ÊµÏÖ¶Ô×Ô¼ºÐÐΪµÄÃèÊö£¨self-representation£©ºÍ¼à²â£¨examination£©£¬²¢Äܸù¾Ý×ÔÉíÐÐΪµÄ״̬ºÍ½á¹û£¬µ÷Õû»òÐÞ¸ÄÓ¦ÓÃËùÃèÊöÐÐΪµÄ״̬ºÍÏà¹ØµÄÓïÒå¡£
¶þ¡¢Ê²Ã´ÊÇJavaÖеÄÀà·´É䣺
Reflection ÊÇ Java ³ÌÐò¿ª·¢ÓïÑÔµÄÌØÕ÷Ö®Ò»£¬ËüÔÊÐíÔËÐÐÖÐµÄ Java ³ÌÐò¶Ô×ÔÉí½øÐмì²é£¬»òÕß˵“×ÔÉ󔣬²¢ÄÜÖ±½Ó²Ù×÷³ÌÐòµÄÄÚ²¿ÊôÐԺͷ½·¨¡£Java µÄÕâÒ»ÄÜÁ¦ÔÚʵ¼ÊÓ¦ÓÃÖÐÓõò»ÊǺܶ࣬µ«ÊÇÔÚÆäËüµÄ³ÌÐòÉè¼ÆÓïÑÔÖиù±¾¾Í²»´æÔÚÕâÒ»ÌØÐÔ¡£ÀýÈ磬Pascal¡¢C »òÕß C++ ÖоÍûÓа취ÔÚ³ÌÐòÖлñµÃº¯Êý¶¨ÒåÏà¹ØµÄÐÅÏ¢¡£
Reflection ÊÇ Java ±»ÊÓΪ¶¯Ì¬£¨»ò×¼¶¯Ì¬£©ÓïÑԵĹؼü£¬ÔÊÐí³ÌÐòÓÚÖ´ÐÐÆÚ Reflection APIs È¡µÃÈκÎÒÑÖªÃû³ÆÖ® class µÄ內²¿ÐÅÏ¢£¬°üÀ¨ package¡¢type parameters¡¢superclass¡¢implemented interfaces¡¢inner classes, outer class, fields¡¢constructors¡¢methods¡¢modifiers£¬並¿ÉÓÚÖ´ÐÐÆÚÉú³Éinstances¡¢±ä¸ü fields 內ÈÝ»ò»½Æð methods¡£
Èý¡¢JavaÀà·´ÉäÖÐËù±ØÐëµÄÀࣺ
JavaµÄÀà·´ÉäËùÐèÒªµÄÀಢ²»¶à£¬ËüÃÇ·Ö±ðÊÇ£ºField¡¢Constructor¡¢Method¡¢Class¡¢Object£¬ÏÂÃæÎÒ½«¶ÔÕâЩÀà×öÒ»¸ö¼òµ¥µÄ˵Ã÷¡£
FieldÀࣺÌṩÓйØÀà»ò½Ó¿ÚµÄÊôÐÔµÄÐÅÏ¢£¬ÒÔ¼°¶ÔËüµÄ¶¯Ì¬·ÃÎÊȨÏÞ¡£·´ÉäµÄ×ֶοÉÄÜÊÇÒ»¸öÀࣨ¾²Ì¬£©ÊôÐÔ»òʵÀýÊôÐÔ£¬¼òµ¥µÄÀí½â¿ÉÒÔ°ÑËü¿´³ÉÒ»¸ö·â×°·´ÉäÀàµÄÊôÐÔµÄÀà¡£
ConstructorÀࣺÌṩ¹ØÓÚÀàµÄµ¥¸ö¹¹Ôì·½·¨µÄÐÅÏ¢ÒÔ¼°¶ÔËüµÄ·ÃÎÊȨÏÞ¡£Õâ¸öÀàºÍFieldÀ಻ͬ£¬FieldÀà·â×°ÁË·´ÉäÀàµÄÊôÐÔ£¬¶øConstructorÀàÔò·â×°ÁË·´ÉäÀàµÄ¹¹Ôì·½·¨¡£
MethodÀࣺÌṩ¹ØÓÚÀà»ò½Ó¿ÚÉϵ¥¶Àij¸ö·½·¨µÄÐÅÏ¢¡£
Ïà¹ØÎĵµ£º
JAVAµÄ¿çƽ̨µÄÌØÐÔÉîÊÜjava³ÌÐòÔ±ÃǵÄϲ°®,µ«ÕýÊÇÓÉÓÚËüΪÁËʵÏÖ¿çƽ̨µÄÄ¿µÄ,ʹµÃËüºÍ±¾µØ»úÆ÷µÄ¸÷ÖÖÄÚ²¿ÁªÏµ±äµÃºÜÉÙ,´ó´óÔ¼ÊøÁËËüµÄ¹¦ÄÜ,±ÈÈçÓëһЩӲ¼þÉ豸ͨÐÅ,ÍùÍùÒª»¨·ÑºÜ´óµÄ¾«Á¦È¥Éè¼ÆÁ÷³Ì±àд´úÂëÈ¥¹ÜÀíÉ豸¶Ë¿Ú,¶øÇÒÓÐһЩÉ豸³§ÉÌÌṩµÄÓ²¼þ½Ó¿ÚÒѾ¾¹ýÒ»¶¨µÄ·â×°ºÍ´¦Àí,²»ÄÜÖ±½ÓʹÓÃjava³ÌÐòͨ¹ý¶Ë¿ÚºÍÉè± ......
C#ÖÐÏÔʾÖÐÎÄ£º
¡¾
·¢ËÍÊý¾Ý£º
string sReturnData = "ÄãºÃ";
Byte[]
bReturnData = Encoding.ASCII.GetBytes(sReturnData.ToCharArray());
m_sktSession.Send(bReturnData);
¡¾½«³öÏÖÂÒÂë¡¿
¡¿  ......
°²×°ºÃjdkÒÔºóÐèÒªÌí¼Ó»·¾³±äÁ¿,²ÅÄÜÔÚÃüÁîÐÐÖÐʹÓÃjavaÃüÁî.
ºÜ¶àÈË"ÎÊΪʲôjavacÕÒ²»µ½"¾ÍÊÇÒòΪûÌí¼Ó»·¾³±äÁ¿.
windows ÉÏ¿Éдһ¸ö.bat½Å±¾:
set JAVA_HOME=d:\Java\jdk1.6.0_20
set PATH=%PATH%;%JAVA_HOME%\bin ......
import java.io.File;
import java.io.FileNotFoundException;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
public class ResolveXmlFile {
public void resolverXml() throws DocumentException, FileNotFoundExcept ......