网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

基于Javaclass对象说明、Java静态变量声明和赋值说明(详解)-创新互联

先看下JDK中的说明:

呼兰ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为创新互联公司的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:18982081108(备注:SSL证书合作)期待与您的合作!
java.lang.Object
  java.lang.Class
  
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 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());
   }
 
It is also possible to get the Class object for a named type (or for void) using a class literal.

  System.out.println("The name of class Foo is: "+Foo.class.getName());

在一个运行着的JAVA应用中,类的任何实例都可以用Class对象来指代,Class可以指代所有的类和接口。枚举属于类,注解属于接口,均可以用Class指代。每个数组均属于反射的Class对象,数组中的每个元素和维度也同样拥有Class对象。Java基本类型(boolean, byte, char, short, int, long, float, and double)以及关键字void也都可以用Class指代。

Class类不存在构造函数,当类被加载过程中由JVM通过调用类加载器中的defineClass方法自动构造。

下面的例子是将一个对象通过Class对象打印出类名。
   void printClassName(Object obj) {
     System.out.println("The class of " + obj +
              " is " + obj.getClass().getName());
   }
通过class关键字指定类型也是可以得到Class对象的
  System.out.println("The name of class Foo is: "+Foo.class.getName());

分享名称:基于Javaclass对象说明、Java静态变量声明和赋值说明(详解)-创新互联
文章出自:http://bjjierui.cn/article/cchego.html

其他资讯