returnOne

In this problem, you're practicing how to instantiate a list in Java and how to use the add method.

Complete the method's logic returnOnethat declares and instantiates an ArrayList of Integers with one element, the number 3.
Return the entire list. 

Example: Adding to an ArrayList

//Declare and instantiate an ArrayList
ArrayList<Integer> myList = new ArrayList<Integer>();

//add 5 to the end of the list using the add method
myList.add(5); 

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.