001package clone.deepVshallow;
002public class Main {
003        public static void main(String[] argv) throws CloneNotSupportedException {
004                Node w = new Node(1, new Node(2, new Node(3)));
005                Node v = w;
006                Node x = (Node) w.shallow_copy();
007                Node y = (Node) w.deep_copy();
008                Node z = (Node) w.shallow_clone();
009
010                System.out.println("w==v: " + ((w == v) ? "true" : "false"));
011                System.out.println("w==x: " + ((w == x) ? "true" : "false"));
012                System.out.println("w==y: " + ((w == y) ? "true" : "false"));
013                System.out.println("w==z: " + ((w == z) ? "true" : "false"));
014                System.out.println("w.equals(v): " + ((w.equals(v)) ? "true" : "false"));
015                System.out.println("w.equals(x): " + ((w.equals(x)) ? "true" : "false"));
016                System.out.println("w.equals(y): " + ((w.equals(y)) ? "true" : "false"));
017                System.out.println("w.equals(z): " + ((w.equals(z)) ? "true" : "false"));
018                System.out.println("w.shallow_equals(v): " +
019                                ((w.shallow_equals(v)) ? "true" : "false"));
020                System.out.println("w.shallow_equals(x): " +
021                                ((w.shallow_equals(x)) ? "true" : "false"));
022                System.out.println("w.shallow_equals(y): " +
023                                ((w.shallow_equals(y)) ? "true" : "false"));
024                System.out.println("w.shallow_equals(z): " +
025                                ((w.shallow_equals(z)) ? "true" : "false"));
026                System.out.println("w.deep_equals(v): " +
027                                ((w.deep_equals(v)) ? "true" : "false"));
028                System.out.println("w.deep_equals(x): " +
029                                ((w.deep_equals(x)) ? "true" : "false"));
030                System.out.println("w.deep_equals(y): " +
031                                ((w.deep_equals(y)) ? "true" : "false"));
032                System.out.println("w.deep_equals(z): " +
033                                ((w.deep_equals(z)) ? "true" : "false"));
034        }
035}