Imagine that I have this class:
public class Test { private String[] arr = new String[]{\"1\",\"2\"}; public String[] getArr() { return arr;
Yes, you should return a a copy of the array:
public String[] getArr() { return Arrays.copyOf(arr); }