public class Foo {
private int field;
public Foo(Foo foo) {
this.field = foo.getField();
}
public int getField() {
return field;
}
public void setField(int field) {
this.field = field;
}
}
Kindly can someone please help me understand this and how it will be initialized in the test class, what it does and if it is legal.