So kopieren Sie ein Objekt in Java
Example example = new Example(1, 2, "Example");
Example copiedExample = new Example(example);
class Example {
public int a;
public int b;
public String c;
// Constructor
public Example(int a, int b, String s) {
// ...
}
// Copy Constructor
public Example(Example example) {
this.a = example.a;
this.b = example.b;
this.s = example.s;
}
}
Pi3141