这里的第三行是什么问题

package pakage;


public class DynamicBindingDemo {

public static void main(String args[]) {

m(new GraduateStudent());

m(new Student());

m(new Person());

m(new Object());

}

public static void m(Object x) {//Object类型可以用任何类型访问它

System.out.println(x.toString());

}

class GraduateStudent extends Student{

}


class Student extends Person{

public String toString() {

return "Student";

}

}


class Person extends Object{

public String toString() {

return "Person";

}

}

}


qq_狼噬夜魇_0
浏览 440回答 1
1回答

柳太爷

?什么意思
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java