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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started