varsToList

In this problem, you're practicing how to create a list and add elements to it that are stored in variables rather than literal values.

Complete the method varsToList which takes in 2 integer parameters and returns them in a list in their respective order. 

For example, a call to varsToList(1, 2) returns a list with the element at index 0 is 1 and the element at index 1 is 2.

Syntax:
ArrayList<DataType> name = new ArrayList<DataType>();

The following are methods of a list that can be used to manipulate the contained data.

Type your solution        
Skills Practiced:
3.d
4.A
4.B
Copyright © StudyCS 2024 All rights reserved.