I've looked lotsa websides but i could not find my answer. My question is Why refrence p's values also changed? Even if i did not changed those? Here is my code and thak yu for explanation.
public static void main(String[] args) {
    Person p = new Person();
    Person q = new Person();
    p.name="Sara";
    p.birthyear= 1989;
    q=p;
    System.out.println("Name is "+q.name+" and birthyear is "+q.birthyear);
    q.name ="Hanna";
    q.birthyear = 1991;
    System.out.println("Name is "+p.name+" and birthyear is "+p.birthyear);
}
}
class Person { 
String name;
String surname;
int birthyear;
}
