LearnFrenzy
Sign in Take a free test

Arrays in Java · Java Arrays MCQ · Question 7

What does b = a do for arrays? Answer, explanation & discussion

  • MCQ
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 7 Back to Exercise

After int[] b = a;, what is true?

  • A b is an independent copy
  • B a and b refer to the same array; changing b[0] changes a[0] Correct
  • C b is empty
  • D It does not compile
Correct Answer: Option B

Use a.clone() for a separate copy.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links