I'm currently learning Java and I had a question regarding some code that we say in class today, I was wondering if anybody could tell me why the following code outputs 5 and 33 as opposed to just two 33's. Aren't we assigning the value of d2 to d1 in the modify function?
public class AClass {
Date d1 = new Date (5L);
Date d2 = new Date (33L);
void modify ( Date x, Date y) {
x=y;
}
public static void main (String[] args) {
new AClass();
}
AClass () {
modify(d1,d2);
System.out.println(d1.getTime());
System.out.println(d2.getTime());
}
}