Question: JAVA L2A3 Complete the getEvens method so it returns a new ArrayList of Integers containing all even Integers from the parameter ArrayList vals in the

JAVA L2A3

Complete the getEvens method so it returns a new ArrayList of Integers containing all even Integers from the parameter ArrayList vals in the order they originally appeared. The contents of vals should not change.

For example, if an ArrayList containing the Integers 1,2,4,5,7 in that order is passed as a parameter to getEvens, it should return an ArrayList containing the Integers 2,4 in that order.

Write your getEvens method in the U7_L2_Activity_Three class. Use the runner class to test your method but do not add a main method to your U7_L2_Activity_Three.java file or your code will not be scored correctly.

what i have so far:

import java.util.ArrayList;

public class U7_L2_Activity_Three {

public static ArrayList getEvens(ArrayList vals) { // Implement this method as described in the assignment }

}

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 Databases Questions!