Question: Array Programming Complete the class code and write a static method named arraySplit that accepts an integer array as its parameter and which creates two
Array Programming
Complete the class code and write a static method named arraySplit that accepts an integer array as its parameter and which creates two new arrays composed of the even and odd elements from the original array. There is no need for your method to return a value, just print the original array and the two new arrays. Assume valid array input.
For example, if the array {36, 14, 27, 1, 14, 77, 89, 11, 58} were passed into the method, the output would be:
[36, 14, 27, 1, 14, 77, 89, 11, 58]
[36, 14, 14, 58]
[27, 1, 77, 89, 11]
import java.util.*;
public class ArraySplit {
public static void main(String[] args) {
int[] arr = {36, 14, 27, 1, 14, 77, 89, 11, 58};
arraySplit(arr);
}
// your code here
} // end of ArraySplit class
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
