Results 1 to 1 of 1
  1. #1
    X-ion is offline Member
    Join Date
    Feb 2010
    Posts
    9
    Rep Power
    0

    Default java Array.length property

    [Edit] let me explain better:D

    If you create an array of primitive types for example:

    int[] foo = new int[10];

    You can call the property .Length on this array. I wanna know how that is possible? Where does the length property come from? I know its not from Object and i know there isnt a "real" Array class...

    Anyway i was discussing it with people and what we think that happens is that the compiler implicitly creates an array object with a length property for you. But we arent sure, we couldnt find another way to explain it. Anyway we want to be sure the happens, or something else happens.

    One of the things is, if its implicitly done, will it be compile time or runtime since you might not know the length at compiletime yet...

    Anyway i hope somebody can help me.

    greetz
    Last edited by X-ion; 04-07-2010 at 04:46 PM.

Similar Threads

  1. Array length and printing out uninitialized array.
    By nicolek808 in forum New To Java
    Replies: 4
    Last Post: 09-10-2009, 10:12 AM
  2. Replies: 0
    Last Post: 06-25-2009, 06:28 AM
  3. Using reflection to check array type and length
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-23-2008, 09:15 PM
  4. Using reflection to check array type and length
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-14-2008, 09:42 PM
  5. property of a java bean
    By suloverboy in forum New To Java
    Replies: 3
    Last Post: 12-14-2007, 10:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •