Question: Odd List & Even List You will be provided with a List of five ( 5 ) integers named numbers and your goal is to
Odd List & Even List
You will be provided with a List of five integers named numbers and your goal is to separate them into new Lists as instructed below:
Create two new Lists called oddNumbers and evenNumbers.
The oddNumbers List should store all the odd integers from numbers
The evenNumbers List should store all the even integers from numbers
Print all three Lists to the console in this order: numbers, oddNumbers, and evenNumbers using the text shown in the Example Output below eg "Original List:
import java.util.;
public class CodingQuestion
static void halfListList numbers
Declare two new lists to store odd and even numbers
Separate odd and even numbers into their respective lists
Print out the original list, the list of odd numbers, and the list of even numbers
public static void mainString args
Scanner in new ScannerSystemin;
List numbers new ArrayList;
for int i ; i ; i
int num innextInt;
numbers.addnum;
halfListnumbers;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
