I'm relatively new to coding so I apologize if this question is stupid. Why is the Arraylist numbers
getting affected by what is happening within the function changeParam
with the parameter of Arraylist for example...
public class Test {
static ArrayList<Integer> numbers = new ArrayList<>();
public static void main(String[] args) {
for(int i = 0; i <= 100; i++){
numbers.add(i);
}
changeParam(numbers);
System.out.println(numbers);
}
public static void changeParam(ArrayList<Integer> A){
A.clear();
}
}
Why when numbers is printed does it come out empty?