class Student {
    void printStuMessage() {
        System.out.println("a student ");
    }
}
class GraduateStudent extends Student {
    void printStuMessage() {
        System.out.println("a graduate student ");
    }
    void printStuMessage(String name) {
        System.out.println("a graduate student : " + name);
    }
}
class Example4_11{
    public static void main(String[] args) {
        GraduateStudent g = null;
        Student s = new Student();
        s.printStuMessage();
        s = new GraduateStudent();                          //向上转型
        s.printStuMessage();
        // s.printStuMessage("Tom");                         //编译错误
        if (s instanceof GraduateStudent) {
            g = (GraduateStudent) s;                        //向下转型
            g.printStuMessage();
            g.printStuMessage("Tom");
        }
    }
}
