书上使用了数组的length成员,还有clone方法,都是直接在数组名后面使用的,比如
int a[]=new int[10];
int[] b=a.clone();有的时候又是用Array类的静态方法操纵数组。不知道两者有何区别?在哪里能看到数组类的成员和方法?
int a[]=new int[10];
int[] b=a.clone();有的时候又是用Array类的静态方法操纵数组。不知道两者有何区别?在哪里能看到数组类的成员和方法?
解决方案 »
- java与QQ的那点事
- 一个jsp页面多个Ec:table问题,在线等!问题解决马上结贴!
- ant调用的build.xml中有一个任务比如start.bat会起几个进程,但一旦这个任务结束,这些进程就自动被停掉,这个可以控制吗?
- 扩展的欧几里得算法, 请教大家!
- 我想在一个程序里面创建30多个线程,这样会不会很影响效率啊?
- 如何用代码实现内建SMTP主机?
- 如何得到一个服务器目前的连接数?
- 在java中调用返回值为Cursor的SQL Server2K存储过程的问题?
- 升级游戏中,如何判断一轮中那个玩家出的牌大?!!!!求算法!
- 用java实现一个小图案
- 将excel内容存入数组中
- 各位高手帮帮忙!mysql装不了
Class clazz = array.getClass();
System.out.println(clazz);
Method[] methods = clazz.getDeclaredMethods();
System.out.println(methods.length);
for(Method m : methods){
System.out.println(m.getName());
} Method[] methodz = clazz.getMethods();
System.out.println(methodz.length);
for(Method m : methodz){
System.out.println(m.getName());
}
Class superclass = clazz.getSuperclass();
System.out.println(superclass.getName()); Class[] interfaces = clazz.getInterfaces();
for(Class i : interfaces){
System.out.println(i.getName());
}
按照Java语言规范的说法:Java数据类型分为两大类:基本数据类型和复合数据类型,其中复合数据类型包括数组、类和接口。
public static void main(String[] args) {
Name[] n = new Name[10];
int[] a = new int[10];
//打印类名
//[I
//[LName;
System.out.println(a.getClass().getName());
System.out.println(n.getClass().getName());
//判断是否为Object或者其子类
//true
//true
System.out.println(a instanceof Object);
System.out.println(n instanceof Object);
//从打印结果看,数组就是类,是Object的子类,只是他比较特殊,语言层面上没有提供 //具体的类名等,在编译期间特殊处理的
}
}class Name {
}具体的查找他属性和方法等,可以用反射,2楼的说清楚了!
that every variable and every expression has a type that is known at compile time.
Types limit the values that a variable (§4.12) can hold or that an expression can
produce, limit the operations supported on those values, and determine the meaning
of the operations. Strong typing helps detect errors at compile time.
The types of the Java programming language are divided into two categories:
primitive types and reference types. The primitive types (§4.2) are the boolean
type and the numeric types. The numeric types are the integral types byte, short,
int, long, and char, and the floating-point types float and double. The reference
types (§4.3) are class types, interface types, and array types. There is also a
special null type. An object (§4.3.1) is a dynamically created instance of a class
type or a dynamically created array. The values of a reference type are references
to objects. All objects, including arrays, support the methods of class Object
(§4.3.2). String literals are represented by String objects (§4.3.3).