Re: confusion of array clone() method




"Patricia Shanahan" <pats@xxxxxxx> wrote in message
news:4pXah.4189$ql2.3040@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
hyena wrote:

this statement does not agree on this example.

could someone shed some light on this? Thanks.

The key issue is what constitutes an array. Java does not really have
multidimensional arrays. tr_seq is an array whose elements are
references to arrays.

clone makes a new array whose elements point to the same arrays as the
original.

For any i from 0 to tt.length-1, tt[i] and tr_seq[i] are identical. They
are either both null, or are pointers to the same array. Changes to an
element of an array they both reference apply regardless of whether you
find that array through tr_seq or tt.

Patricia


Thanks Patricia, and the others. This explaination makes the idea clear to
me.

thanks!


.



Relevant Pages

  • Re: Test if memory pointer is valid?
    ... I can see setting a new pointer initially to the address of the beginning of an array, for example, and then incrementing the pointer to address subsequent elements, but that would usually be done inside a function, where the new pointer would go out of scope at the end of the function and be reinitialized if it is called again. ... I would like to see a specific example where it is necessary to have multiple references such as this where it would be necessary to check for it having been freed. ... copies of all the TLabel references already in the form as individual ...
    (comp.lang.pascal.delphi.misc)
  • Re: UBound not in Intellisense. References problem?
    ... but you can produce an array by using Value ... I wouldn't worry about it not appearing in intellisense. ... > I wonder if I have a corruption in my registration of References, ... I get UCase, UCase$, but no UBound. ...
    (microsoft.public.excel.programming)
  • Re: translation from c to java. array trouble
    ... pointer arithmetic is not allowed in java. ... > implementing indexing with base, there thousands array references... ...
    (comp.lang.java.programmer)
  • Re: How come Ada isnt more popular?
    ... The language does not require array implementation to be contiguous. ... then But non contigous representation of arrays will really stress ... It's easy with value-oriented languages (i.e. languages ... use references because of that. ...
    (comp.lang.ada)
  • Re: Reclaiming Memory
    ... example, handles to device context, memory addresses, etc.), VB is actually ... VB will clean up references to objects all ... It's a little unusual to use an array to store object references. ... unusual to use a variant array for what you apparently are (at least I'VE ...
    (microsoft.public.vb.com)