Answers for "how to read returned arraylist from another class method"

0

how to read returned arraylist from another class method

import java.util.ArrayList;
public class numbers {
   private int number1 = 50;
   private int number2 = 100;
   private List<Integer> list;

   public numbers() {
       list = new ArrayList<Integer>();
       list.add(number1);
       list.add(number2);
   }

   public List<Integer> getList() {
       return list;
   }
}
Posted by: Guest on December-09-2020
0

how to read returned arraylist from another class method

import java.util.ArrayList;
public class test {
   private numbers number;

   //example
   public test() {
     number = new numbers();
     List<Integer> list = number.getList();
     //hurray !
   }
}
Posted by: Guest on December-09-2020

Code answers related to "how to read returned arraylist from another class method"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language