JAVA·´ÉäÀà
import java.lang.reflect.Array;
public class ReflectionTest {
public static void main(String[] args) {
try {
Example obj = new Example();
java.lang.reflect.Field[] F1 = obj.getClass().getDeclaredFields();
String Name = new String();
for (int i = 0; i < F1.length; i++) {
System.out.println(F1[i].getType());
System.out.println(F1[i].getName());
Name = F1[i].getName();
}
//Assume that you have known that "F1[1]" is the char array
int length = Array.getLength(F1[1].get(obj));
System.out.println("The length of c1 is: " + length);
} catch (Exception e) {
System.out.println("err occur");
}
}
}
class Example {
int I1 = 3;
char c1[] = new char[10];
}
Ïà¹ØÎĵµ£º
ÀàµÄ³õʼ»¯ºÍ¶ÔÏó³õʼ»¯ÊÇ JVM ¹ÜÀíµÄÀàÐÍÉúÃüÖÜÆÚÖзdz£ÖØÒªµÄÁ½¸ö»·½Ú£¬Google ÁËÒ»±éÍøÂ磬ÓйØÀà×°ÔØ»úÖÆµÄÎÄÕµ¹ÊDz»ÉÙ£¬È»¶øÀà³õʼ»¯ºÍ¶ÔÏó³õʼ»¯µÄÎÄÕ²¢²»¶à£¬ÌرðÊÇ´Ó×Ö½ÚÂëºÍ JVM ²ã´ÎÀ´·ÖÎöµÄÎÄÕ¸üÊÇÏÊÓÐËù¼û¡£
±¾ÎÄÖ÷Òª¶ÔÀàºÍ¶ÔÏó³õʼ»¯È«¹ý³Ì½øÐзÖÎö£¬Í¨¹ýÒ»¸öʵ¼ÊÎÊÌâÒýÈ룬½«Ô´´úÂëת»»³É JVM ×Ö½ÚÂëºó£¬ ......
¸ÐлÔÎÄ×÷Õß:http://blog.sina.com.cn/s/blog_62a6ceb10100gwe0.html
JAVAÆäʵ²»ËãÊÇÒ»ÃŶ¯Ì¬ÓïÑÔ£¬µ«JAVAÖÐÈ´ÓÖÒ»ÖÖ»úÖÆ¿ÉÒÔ´ïµ½¶¯Ì¬µÄijÖÐЧ¹û£¬Õâ¾ÍÊÇJAVAÖеķ´Éä¡£
JAVA·´ÉäÖ¸µÄÊÇÎÒÃÇ¿ÉÒÔÓÚÔËÐÐʱ¼ÓÔØ¡¢Ì½Öª¡¢Ê¹ÓñàÒëÆÚ¼äÍêȫδ֪µÄclasses¡£
¶¼Ja ......
¿ÉÄܺܶàjavaµÄ³õѧÕß¶ÔStringµÄ´æ´¢ºÍ¸³ÖµÓÐÃÔ»ó£¬ÒÔÏÂÊÇÒ»¸öºÜ¼òµ¥µÄ²âÊÔÓÃÀý£¬ÄãÖ»ÐèÒª»¨¼¸·ÖÖÓʱ¼ä±ã¿ÉÀí½â¡£
1.ÔÚ¿´Àý×Ó֮ǰ£¬È·±£ÄãÀí½âÒÔϼ¸¸öÊõÓ
Õ» £ºÓÉJVM·ÖÅäÇøÓò£¬ÓÃÓÚ±£´æÏß³ÌÖ´Ðе͝×÷ºÍÊý¾ÝÒýÓá£Õ»ÊÇÒ»¸öÔËÐеĵ¥Î»£¬JavaÖÐÒ»¸öÏ߳̾ͻáÏàÓ¦ÓÐÒ»¸öÏß³ÌÕ»ÓëÖ®¶ÔÓ¦¡£
¶Ñ £ºÓÉJVM·ÖÅä ......
javaʵս¼¼ÇÉ--¹ØÓÚ¸ñʽ»¯Êä³öÈÕÆÚ
ʹÓÃSimpleDateFormat ¸ñʽ»¯Êä³öÈÕÆÚÓë
ʹÓÃCalendar ¸ñʽ»¯Êä³öÈÕÆÚ
ÔÚºÄʱÉϵĶԱÈÈçÏÂ
²âÊÔÈí¼þƽ̨
win 7,CUP T4200,ÄÚ´æ 2G,
eclipse 3.5,
android sdk1.5
²âÊÔÓ²¼þƽ̨
T Mobile G1,
SimpleDateFormatµÄÊä³öÒª±ÈCalendar Âý2±¶ÒÔÉÏ
SimpleDateFormatµÄ¸ñʽÓÐÏÞÖÆ
±ÈÈç ......
JavaÓïÑÔ¶¨ÒåÁËpublic¡¢protected¡¢private¡¢abstract¡¢staticºÍfinalÕâ6ÖÖ³£ÓÃÐÞÊδÊÍ⻹¶¨ÒåÁË5¸ö²»Ì«³£ÓõÄÐÞÊδʣ¬ÏÂÃæÊǶÔÕâ11¸öJavaÐÞÊδʵĽéÉÜ£º
1.public
ʹÓöÔÏó£ºÀà¡¢½Ó¿Ú¡¢³ÉÔ±
½éÉÜ£ºÎÞÂÛËüËù´¦Ôڵİü¶¨ÒåÔÚÄÄ£¬¸ÃÀࣨ½Ó¿Ú¡¢³ÉÔ±£©¶¼ÊǿɷÃÎʵÄ
2.private
ʹÓöÔÏ󣺳ÉÔ±
½éÉÜ£º³ÉÔ ......