java help


Which is the best approach to copying elements from part of one array b to another array c?
a) Use a for loop.
b) Use b.clone( ).
c) Use the assignment operator c = b.
d) Use System.arraycopy

Comments

  • :
    : Which is the best approach to copying elements from part of one array b to another array c?
    : a) Use a for loop.
    : b) Use b.clone( ).
    : c) Use the assignment operator c = b.
    : d) Use System.arraycopy
    :
    :

    //Either a or d. The for loop lets you copy part of an array quite easily, but if I understood the documentation on System.arraycopy right that one seems more efficient-
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion