public class Human {
public String name;
public Human(String name) {
this.name = name;
}
}
public class Student {
private Human human;
private int id;
public Student(Human human, int id) {
this.human = human;
this.id = id;
}
}
public static void main(String[] args) {
Human h = new Human("foo");
Student s = new Student(h, 1);
// changing the Human object which is supposed to be private.
h.name = "bar";
}