how to read returned arraylist from another class method

Solutions on MaxInterview for how to read returned arraylist from another class method by the best coders in the world

showing results for - "how to read returned arraylist from another class method"
Ella
12 Jan 2019
1import java.util.ArrayList;
2public class test {
3   private numbers number;
4
5   //example
6   public test() {
7     number = new numbers();
8     List<Integer> list = number.getList();
9     //hurray !
10   }
11}
12
Matteo
01 Apr 2018
1import java.util.ArrayList;
2public class numbers {
3   private int number1 = 50;
4   private int number2 = 100;
5   private List<Integer> list;
6
7   public numbers() {
8       list = new ArrayList<Integer>();
9       list.add(number1);
10       list.add(number2);
11   }
12
13   public List<Integer> getList() {
14       return list;
15   }
16}
17