I am in some sort of weird problem in Java. I've nailed down the whole problem while debugging it. It happens at these 2 lines:
q=p;
q.addPair(2,3);
notes: p,q is a new class I've defined. In this class, it has a public function addPari(int, int).
Here is what I expected: copy p to q, then change q use q.addPair(), but leave p the same as before.
I thought this could work, but somehow, it turns out q.addPair(2,3) will change both p and q. Anyone can help me about that?