编辑代码

interface Transportation {
    void goToNorthEast();
}

class Car implements Transportation {
    public void goToNorthEast() {
        System.out.println("老张开车去东北");
    }
}

class Plane implements Transportation {
    public void goToNorthEast() {
        System.out.println("老张坐飞机去东北");
    }
}

class Train implements Transportation {
    public void goToNorthEast() {
        System.out.println("老张坐火车去东北");
    }
}

class Person {
    private String name;
    private Transportation transportation;

    public Person(String name) {
        this.name = name;
    }

    public void setTransportation(Transportation t) {
        this.transportation = t;
    }

    public void goToNorthEast() {
        transportation.goToNorthEast();
    }
}