Machine-translated by Google. Questions are authored in English.
Top

Discussion

Consider what System.arraycopy does that a loop does not. Which statement is correct?

  • A.It returns the copied range as a new array.
  • B.It copies a range between arrays in one native call.
  • C.It grows the destination array if the range does not fit.
  • D.It converts the element type when the two arrays differ.

Answer: B

It is a low-level bulk copy with explicit source and destination offsets, defined to behave as if the source range had been copied to a temporary first, so shifting elements within one array is safe. It writes into an existing array and returns nothing; Arrays.copyOf is the allocating convenience built on it.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.