Question: 9 . 4 . 5 : Complete the code to make a copy of the first half of an array. 5 9 7 7 1

9.4.5: Complete the code to make a copy of the first half of an array.
597714.2988516.qx3zqy7
Complete the following code to make a copy of the first half of an array of strings.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import java.util.Arrays;
public class CopyHalf
{
/**
Copies the first half of an array. If the length is odd,
don't copy the middle value.
@param values an array
@return a copy of the first half of values
*/
public static /* Your code goes here */ copyHalf(String[] values)
{
/* Your code goes here */
}
public static void main(String[] args)
{
String[] arr1={ "Mary", "had", "a", "little", "lamb" };
System.out.println("Full Array 1: "+ Arrays.toString(arr1));

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!