int.class和Integer.class有何不同?

来源:互联网 发布:网络审核员天河 编辑:程序博客网 时间:2024/06/05 18:45

public class Test {

/**
* @param args
*/
public static void main(String[] args) {
/**
* 基本的 Java 类型(boolean、byte、char、short、int、long、float 和 double)
* 和关键字 void 也表示为 Class 对象。 

* 代表Class类的不同实例(个人感觉)
*/
Class c = int.class;
Class c0 = Integer.class;
System.out.println(c+" : "+c0);
System.out.println(c.getName()+" : "+c0.getName());

/**
* 输出:
* int : class java.lang.Integer
*  int : java.lang.Integer
*/

}

}