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

Java·´Éä»úÖÆÉîÈëÑо¿

           
Java ·´ÉäÊÇJavaÓïÑÔµÄÒ»¸öºÜÖØÒªµÄÌØÕ÷£¬ËüʹµÃJava¾ßÌåÁË“¶¯Ì¬ÐÔ”¡£
 
ÔÚJavaÔËÐÐʱ»·¾³ÖУ¬¶ÔÓÚÈÎÒâÒ»¸öÀ࣬ÄÜ·ñÖªµÀÕâ¸öÀàÓÐÄÄЩÊôÐԺͷ½·¨£¿¶ÔÓÚÈÎÒâÒ»¸ö¶ÔÏó£¬ÄÜ·ñµ÷ÓÃËüµÄÈÎÒâÒ»¸ö·½·¨£¿´ð°¸Êǿ϶¨µÄ¡£ÕâÖÖ¶¯Ì¬»ñÈ¡ÀàµÄÐÅÏ¢ÒÔ¼°¶¯Ì¬µ÷ÓöÔÏóµÄ·½·¨µÄ¹¦ÄÜÀ´×ÔÓÚJava ÓïÑԵķ´É䣨Reflection£©»úÖÆ¡£
 
Java ·´Éä»úÖÆÖ÷ÒªÌṩÁËÒÔϹ¦ÄÜ£º
ÔÚÔËÐÐʱÅжÏÈÎÒâÒ»¸ö¶ÔÏóËùÊôµÄÀà¡£
ÔÚÔËÐÐʱ¹¹ÔìÈÎÒâÒ»¸öÀàµÄ¶ÔÏó¡£
ÔÚÔËÐÐʱÅжÏÈÎÒâÒ»¸öÀàËù¾ßÓеijÉÔ±±äÁ¿ºÍ·½·¨¡£
ÔÚÔËÐÐʱµ÷ÓÃÈÎÒâÒ»¸ö¶ÔÏóµÄ·½·¨¡£
 
Reflection ÊÇJava±»ÊÓΪ¶¯Ì¬£¨»ò×¼¶¯Ì¬£©ÓïÑÔµÄÒ»¸ö¹Ø¼üÐÔÖÊ¡£Õâ¸ö»úÖÆÔÊÐí³ÌÐòÔÚÔËÐÐʱ͸¹ýReflection APIsÈ¡µÃÈκÎÒ»¸öÒÑÖªÃû³ÆµÄclassµÄÄÚ²¿ÐÅÏ¢£¬°üÀ¨Æämodifiers£¨ÖîÈçpublic, static µÈµÈ£©¡¢superclass£¨ÀýÈçObject£©¡¢ÊµÏÖÖ®interfaces£¨ÀýÈçSerializable£©£¬Ò²°üÀ¨fieldsºÍmethodsµÄËùÓÐÐÅÏ¢£¬²¢¿ÉÓÚÔËÐÐʱ¸Ä±äfieldsÄÚÈÝ»òµ÷ÓÃmethods¡£
 
Ò»°ã¶øÑÔ£¬¿ª·¢ÕßÉçȺ˵µ½¶¯Ì¬ÓïÑÔ£¬´óÖÂÈÏͬµÄÒ»¸ö¶¨ÒåÊÇ£º“³ÌÐòÔËÐÐʱ£¬ÔÊÐí¸Ä±ä³ÌÐò½á¹¹»ò±äÁ¿ÀàÐÍ£¬ÕâÖÖÓïÑÔ³ÆΪ¶¯Ì¬ÓïÑÔ”¡£´ÓÕâ¸ö¹Ûµã¿´£¬Perl£¬Python£¬RubyÊǶ¯Ì¬ÓïÑÔ£¬C++£¬Java£¬C#²»ÊǶ¯Ì¬ÓïÑÔ¡£
 
¾¡¹ÜÔÚÕâÑùµÄ¶¨ÒåÓë·ÖÀàÏÂJava²»ÊǶ¯Ì¬ÓïÑÔ£¬ËüÈ´ÓÐ×ÅÒ»¸ö·Ç³£Í»³öµÄ¶¯Ì¬Ïà¹Ø»úÖÆ£ºReflection¡£Õâ¸ö×ÖµÄÒâ˼ÊÇ“·´Éä¡¢Ó³Ïó¡¢µ¹Ó°”£¬ÓÃÔÚJavaÉíÉÏÖ¸µÄÊÇÎÒÃÇ¿ÉÒÔÓÚÔËÐÐʱ¼ÓÔØ¡¢Ì½Öª¡¢Ê¹ÓñàÒëÆÚ¼äÍêȫδ֪µÄclasses¡£»»¾ä»°Ëµ£¬Java³ÌÐò¿ÉÒÔ¼ÓÔØÒ»¸öÔËÐÐʱ²ÅµÃÖªÃû³ÆµÄclass£¬»ñϤÆäÍêÕû¹¹Ô죨µ«²»°üÀ¨methods¶¨Ò壩£¬²¢Éú³ÉÆä¶ÔÏóʵÌå¡¢»ò¶ÔÆäfieldsÉèÖµ¡¢»ò»½ÆðÆämethods¡£ÕâÖÖ“¿´Í¸class”µÄÄÜÁ¦£¨the ability of the program to examine itself£©±»³ÆΪintrospection£¨ÄÚÊ¡¡¢ÄÚ¹Û¡¢·´Ê¡£©¡£ReflectionºÍintrospectionÊdz£±»²¢ÌáµÄÁ½¸öÊõÓï¡£
 
ÔÚJDKÖУ¬Ö÷ÒªÓÉÒÔÏÂÀàÀ´ÊµÏÖJava·´Éä»úÖÆ£¬ÕâЩÀ඼λÓÚjava.lang.reflect°üÖУº
ClassÀࣺ´ú±íÒ»¸öÀà¡£
Field Àࣺ´ú±íÀàµÄ³ÉÔ±±äÁ¿£¨³ÉÔ±±äÁ¿Ò²³ÆΪÀàµÄÊôÐÔ£©¡£
MethodÀࣺ´ú±íÀàµÄ·½·¨¡£
Constructor Àࣺ´ú±íÀàµÄ¹¹Ôì·½·¨¡£
ArrayÀࣺÌṩÁ˶¯Ì¬´´½¨Êý×飬ÒÔ¼°·ÃÎÊÊý×éµÄÔªËصľ²Ì¬·½·¨¡£
 
ÏÂÃæ¸ø³ö¼¸¸öÀý×Ó¿´¿´Reflection APIµÄʵ¼ÊÔËÓãº
 


Ïà¹ØÎĵµ£º

Java ÔËËã·û×ܼÆ

1.ËãÊõÔËËã·û
    JavaµÄËãÊõÔËËã·û·ÖΪһԪÔËËã·ûºÍ¶þÔªÔËËã·û¡£Ò»ÔªÔËËã·ûÖ»ÓÐÒ»¸ö²Ù×÷Êý£»¶þÔªÔËËã·ûÓÐÁ½¸ö²Ù×÷Êý£¬ÔËËã·ûλÓÚÁ½¸ö²Ù×÷ÊýÖ®¼ä¡£ËãÊõÔËËã·ûµÄ²Ù×÷Êý±ØÐëÊÇÊýÖµÀàÐÍ¡£
    (1)Ò»ÔªÔËËã·û£º
    Ò»ÔªÔËËã·ûÓУºÕý£¨+£©¡¢¸º£¨£­£©¡¢¼Ó1£¨++£©ºÍ¼õ1£¨£­£­£ ......

JAVA×Ö·û´®Àà

import java.util.*;
import java.util.regex.Pattern;
public class StrTools {
/**
* ·Ö¸î×Ö·û´®
*
* @param str String ԭʼ×Ö·û´®
* @param splitsign String ·Ö¸ô·û
* @return String[] ·Ö¸îºóµÄ×Ö·û´®Êý×é
*/
@SuppressWarnings("unchecked")
public static String[] split(Stri ......

Ò»¸öºÃÓõÄÈÕÆÚʱ¼äÀà(java)

import java.util.*;
import java.text.*;
/**
* a <code> DateTime </code> ¶¨ÒåÁËÈÕÆÚʱ¼äµÄһЩ±ã½ÝµÄ¸ñʽ»¯²Ù×÷
*
* @version 1.0
* @author markhuang
*/
public class DateTime {
/**
* ´æ´¢Ê±¼äºÍÈÕÆÚ£¬Ä¬Èϵ±Ç°Ê±¼äºÍÈÕÆÚ
*/
// private Calendar cale = Calendar.getInstance ......

java¸ñʽ»¯ÈÕÆÚʱ¼äµÄº¯Êý

Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyÄêMMÔÂddÈÕ HH:mm:ss");
System.out.println(sdf.format(date));
SimpleDateFormat sdf2 = new SimpleDateFormat("MM");
System.out.println(sdf2.format(date));
Calendar c = Calendar.getInstance();
System.out.println(c.get(C ......

javaÈçºÎÀォÎļþ´æµ½Êý¾Ý¿âÖÐ

public class InsertBlobData {
Connection con = null;
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
InsertBlobData data = new InsertBlobData();
data.insertBlogInfo("002jpg", "sdsdfdf", "2007-02-1 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ