Question: Write a method called getOddsEvens ( ) in java that takes a boolean and an Integer ArrayList as parameters. If the boolean parameter is true,

Write a method called getOddsEvens() in java that takes a boolean and an Integer ArrayList as parameters.
If the boolean parameter is true, print only the even integers separated by a newline.
If the boolean parameter is false, print only the odd integers separated by a newline.
Compile and test your code with a few different values
Test your code with: TRUE & 13,22,8,31
Expected Output
22
8
Test your code with: FALSE & 13,22,8,31
Expected Output
13
31
Test your code with: TRUE & 1,2,3,4,5
Expected Output
2
4
Test your code with: FALSE & 1,2,3,4,5
Expected Output
1
3
5

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!