Take the 2-minute tour ×  As far as I know and researched,
arrays in Java are not objects but they're reference-types. My
doubt is, when I want to return an array should I return a deep
copy (like you would do with an object) with a clone() method
for example, or can I return the variable countaining the array
like it was a simple-type variable (ie. int or double) with a
get method? For clarification porpuses, I will insert an example
code to expose this situation:  public class List     //
Instance Variables ----------     private int[] list1;
private int[] list2;     // Constructors ----------    public
List()      list1 = new int[0]; list2 = new int[0];    public
List(List x)        list1 = x.getList1();        list2 =
x.getList2();       // Get methods     public int[] getList1()
return list1;      public int[] getList2()         return list2;
// Set methods     public void setList1(int size)         list1
= new int[size];       public void setList2(int size)
list2 = new int[size]