java.lang.Class

Type Parameters:
T- the type of the class modeled by this Classobject. For example, the type of String.classis Class<String>. Use Class<?>if the class being modeled is unknown.

类的类型设计是通过这类的object对象,例如,string类的类型是class<String>.

使用这个class<?>被设计的是不知道的

All Implemented Interfaces:

Serializable, AnnotatedElement, GenericDeclaration, Type
public final class Class<T>
extends Object implements Serializable, GenericDeclaration, Type, AnnotatedElement

Instances of the classClassrepresent(表现,代表)classes and interfaces in a running Java application. An enum is a kind of class and anannotation(批注)is a kind of interface. Every array also belongs(被..存放) to a class that is reflected(反射)as aClassobject 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, anddouble), and the keyword(关键字)voidare also represented asClassobjects.


类的实例表现类和接口在java的应用程序中,枚举是类的一种,和..是一种接口。

每个数组被存放一个类,这个类是作为一个类的object对象反射,object对象反射类通过数组中这相同元素类型和

Java类型boolean,byte,char,short,int,long,float, anddouble和关键字 void 是作为一个类对象


Classhas no public constructor(构造). Instead(反而)Classobjects are constructedautomatically(自动的)by the Java Virtual Machine as classes are loaded and by calls to thedefineClassmethod in the class loader.


类没有共有的构造函数,反而类被自动加载通过Java虚拟机调用defineClass方法


The following example uses aClassobject 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
See Also:
ClassLoader.defineClass(byte[], int, int), Serialized Form

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值