【简答题】
预测程序运行结果classPerson{Stringname;PublicvoidsetName(Stringname){this.name=name;}publicStringgetName(){returnname;}}classStudentextendsPerson{}classTeacherextendsPerson{}publicclassStudentDemo{publicstaticvoidmain(String[]args){Students=newStudent();s.setName("Tom");System.out.println(s.getName());Teachert=newTeacher();t.setName("John");System.out.println(t.getName());}}
参考答案:
参考解析:
举一反三