Re: Java Arrays Question

  • From: Dave <davidct1209@xxxxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Wed, 30 Mar 2011 22:10:32 -0700

Was curious about this.  From what I've read, you can think of an
array as a class and java seems to treat it under the hood as one.

See:
http://java.sun.com/docs/books/jls/second_edition/html/arrays.doc.html

Noteably:
        public static void main(String[] args) {
                int[] ia = new int[3];
                System.out.println(ia.getClass());
                System.out.println(ia.getClass().getSuperclass());
        }
}

which prints:

class [I
class java.lang.Object

where the string "[I" is the run-time type signature for the class
object "array with component type int".


On 3/29/11, Homme, James <james.homme@xxxxxxxxxxxx> wrote:
> Hi Ty,
> OK. I thought that I saw somewhere that you could, for example, make an
> array, then write a loop for an index that checks for array_name.length, as
> if length was a member of array_name. But I'm still trying to get a grip on
> this, so I probably should check again.
>
> Thanks.
>
> Jim
>
> From: programmingblind-bounce@xxxxxxxxxxxxx
> [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Littlefield,
> Tyler
> Sent: Tuesday, March 29, 2011 10:33 AM
> To: programmingblind@xxxxxxxxxxxxx
> Subject: Re: Java Arrays Question
>
> Jim:
> An array like in some languages (Javascript, for one) is not a class. It is
> just a collection of elements. There may be functions to operate on arrays,
> but it's not a class.
> On 3/29/2011 8:14 AM, Homme, James wrote:
>
> Hi,
>
> I pasted the statement from here.
> http://download.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html
>
>
>
> Jim
>
>
>
> From:
> programmingblind-bounce@xxxxxxxxxxxxx<mailto:programmingblind-bounce@xxxxxxxxxxxxx>
> [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Littlefield,
> Tyler
> Sent: Tuesday, March 29, 2011 9:54 AM
> To: programmingblind@xxxxxxxxxxxxx<mailto:programmingblind@xxxxxxxxxxxxx>
> Subject: Re: Java Arrays Question
>
>
>
> Did you read his message? google won't do any good, since an array is not a
> class, and I think he was viewing it as a class.
> On 3/29/2011 7:52 AM, John G wrote:
>
> Google is your best friend, Jim.
> java class class_name
> Usually brings up the right pages for me.
> Kind regards
> John
> At 14:45 29/03/2011, you wrote:
>
> Hi,
> When you write
> anArray = new int[10];  // create an array of integers
>
> Does this make an instance of an array class? If so, where is the
> documentation for the class. I have to be missing it.
>
> Thanks.
>
> Jim
>
> This e-mail and any attachments to it are confidential and are intended
> solely for use of the individual or entity to whom they are addressed. If
> you have received this e-mail in error, please notify the sender immediately
> and then delete it. If you are not the intended recipient, you must not
> keep, use, disclose, copy or distribute this e-mail without the author's
> prior permission. The views expressed in this e-mail message do not
> necessarily represent the views of Highmark Inc., its subsidiaries, or
> affiliates.
>
>
>
> --
>
>
>
> Thanks,
>
> Ty
>
>
>
>
> --
>
>
>
> Thanks,
>
> Ty
>
__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: