Class,Method

  • public final class Class<T>
    extends Object
    implements Serializable, GenericDeclaration, Type, AnnotatedElement
    Instances of the class Class represent classes and interfaces in a running Java application. An enum is a kind of class and an annotation注释is a kind of interface. 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 thedefineClass 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());
         }
     

    It is also possible to get the Class object for a named指定type (or for void) using a class literal类字面值. See Section 15.8.2 ofThe Java™ Language Specification. For example:

    System.out.println("The name of class Foo is: "+Foo.class.getName());
    Since:
    JDK1.0
    See Also:

    ClassLoader.defineClass(byte[], int, int), Serialized Form




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值