004-002-010
Array Copying with Arrays.copyOf()
Medium
Problem Description
Array Copying with Arrays.copyOf()
Learning Objective: Understand how to copy and resize arrays using Arrays.copyOf()
Overview
Use Arrays.copyOf() to copy and expand arrays.
Specifications
- Create original array {1, 2, 3}
- Copy with same size
- Copy with expanded size (5 elements)
- Verify original and copy are independent
Output Format
Original: 1 2 3
Copy: 1 2 3
Expanded: 1 2 3 0 0
After modifying copy, original: 1 2 3
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
