Shallow Copy in Java
- by Vilius
Hello there!
I already know, what a shallow copy is, but I'm not able to impliment it. Here's a short example.
public class Shallow {
String name;
int number;
public Shallow (String name, int number) {
this.name = name;
this.number = number;
}
}
Test the implementation ...
public class ShallowTest {
public static void main (String[]…