Having a class itself as its constructor's only parameter

前端 未结 4 1950
星月不相逢
星月不相逢 2021-01-20 09:51
public class Foo{
    private String a;
    private int b;

    public Foo(Foo foo){
        this.a = foo.a;
        this.b = foo.b;
    }
}

Hi eve

4条回答
  •  隐瞒了意图╮
    2021-01-20 10:05

    This is nonse code. You need instance of class to create instance... How you want to create the first instance of this object at all?

提交回复
热议问题