Class对象能够代表被JVM加载进来的所有的类,注意是这些类本身,而不是这些类的实例,通常,对程序员来说,类是产生实例的模板,但对JVM来说,每一个这种模板当然也是一个对象,Class的实例就能代表这种类对象,该类的一些方法就能获得许多关于类的信息,比如某个类的名字,这个类所拥有的方法等等。我觉得能够在运行时获取许多类本身的信息,这是许多编程框架(如struts)实现的基础,。
解决方案 »
- 急,高手指教,用poi来解析.doc,docx,rtf,txt
- 看不懂啊,谁能帮我解释下!
- 如何表示JCheckBox是否被选中
- 偶前不久见到的一个面试题,看看你的基本功!
- 【菜鸟提问】 继承问题,子类找不到构造函数
- java图形编程方面遇到问题,请求帮忙!
- 中文转化成16进制
- 装Sun ONE Studio 5 SE的时候用的试用序列号,现在如何改回来?
- 求救:简单的单向链表,this.next.add(newNode)与add(this.next)的区别
- 简单问题 JDK1。3在win98下怎么设置路径 我放在c根目录下的 请详细一点~
- 最后130分全散了 顺便问下问题 过者留言
- 100分求一个算法,用java实现:根据输入小数点后的位数,来输出PI的值。解决立即给分,在线等!
Class Class
java.lang.Object
|
+-java.lang.ClassAll Implemented Interfaces:
Serializable --------------------------------------------------------------------------------public final class Class
extends Object
implements Serializable
Instances of the class Class represent classes and interfaces in a running Java application. Every array also belongs to a class that is reflected as a Class object that is shared by all arrays with the same element type and number of dimensions. The primitive Java types (boolean, byte, char, short, int, long, float, and double), and the keyword void are also represented as Class objects. Class has no public constructor. Instead Class objects are constructed automatically by the Java Virtual Machine as classes are loaded and by calls to the defineClass method in the class loader. The following example uses a Class object to print the class name of an object:
void printClassName(Object obj) {
System.out.println("The class of " obj
" is " obj.getClass().getName());
}
Since:
JDK1.0
所以它是最重要的类!!!