Re: arrays and cloning, where is it described?
- From: "Mike Schilling" <mscottschilling@xxxxxxxxxxx>
- Date: Thu, 06 Mar 2008 19:54:39 GMT
"Daniel Pitts" <newsgroup.spamfilter@xxxxxxxxxxxxxxxxxxx> wrote in message
news:47d03704$0$9361$4d87748@xxxxxxxxxxxxxxxxxxxxxxxxxx
Mike Schilling wrote:
"Patricia Shanahan" <pats@xxxxxxx> wrote in messagepublic class Foo {
news:13t06edrauqekc9@xxxxxxxxxxxxxxxxxxxxx
Andreas Leitgeb wrote:
Mike Schilling <mscottschilling@xxxxxxxxxxx> wrote:...
That is an implementation detail in compilers that target bytecode, notIn what ways are arrays not objects?Don't know, if that's what Daniel meant, but arrays are not
accessed through get-/putfield (except for length) or invoke...
opcodes, but through <x>aload/<x>astore opcodes for <x> any
of [abcdfils].
a Java language feature.
What Patricia said.
All of the array types (i.e. array of X) are subclasses [1] of Object; to
me, that says that arrays are objects.
1. Descendents, anyway. Do we know for a fact that their immediate
superclass is Object?
public static void main(String[] args) {
System.out.println("Class: " + args.getClass());
System.out.println("Super: " + args.getClass().getSuperclass());
final List<? extends Class<?>> interfaces =
Arrays.asList(args.getClass().getInterfaces());
System.out.println("Interfaces: " + interfaces);
final List<Field> fields =
Arrays.asList(args.getClass().getFields());
System.out.println("Fields:" + fields);
final List<Field> declaredFields =
Arrays.asList(args.getClass().getDeclaredFields());
System.out.println("Declared Fields:" + declaredFields);
}
}
Class: class [Ljava.lang.String;
Super: class java.lang.Object
Interfaces: [interface java.lang.Cloneable, interface
java.io.Serializable]
Fields:[]
Declared Fields:[]
Yes, I know that the superclass is Object *now*, but I don't know whether
this is guaranteed.
.
- Follow-Ups:
- Re: arrays and cloning, where is it described?
- From: Patricia Shanahan
- Re: arrays and cloning, where is it described?
- References:
- arrays and cloning, where is it described?
- From: Andreas Leitgeb
- Re: arrays and cloning, where is it described?
- From: Patricia Shanahan
- Re: arrays and cloning, where is it described?
- From: Andreas Leitgeb
- Re: arrays and cloning, where is it described?
- From: Patricia Shanahan
- Re: arrays and cloning, where is it described?
- From: Daniel Pitts
- Re: arrays and cloning, where is it described?
- From: Mike Schilling
- Re: arrays and cloning, where is it described?
- From: Andreas Leitgeb
- Re: arrays and cloning, where is it described?
- From: Patricia Shanahan
- Re: arrays and cloning, where is it described?
- From: Mike Schilling
- Re: arrays and cloning, where is it described?
- From: Daniel Pitts
- arrays and cloning, where is it described?
- Prev by Date: About to give up
- Next by Date: Re: Tomcat: using webapp context to override default URL
- Previous by thread: Re: arrays and cloning, where is it described?
- Next by thread: Re: arrays and cloning, where is it described?
- Index(es):
Relevant Pages
|