高等继续教育 / Java程序设计
正确率:100%
【Java程序设计】模拟试题
阅读以下程序,给出程序的输出结果。publicclassFather {String name, address, tel;intage;publicFather(String name, intage) {this.name= name;this.age= age;}voidout() {System.out.print("姓名:"+ name);System.out.print(" 年龄:"+ age);}voidoutOther() {System.out.print(" 家庭住址:"+ address);System.out.print(" 电话:"+ tel);}}classSon extendsFather {String school;publicSon(String name, intage) {super(name, age);}voidout() {super.out();super.outOther();System.out.println(" 学校:"+ school);}publicstaticvoidmain(String args[]) {Son son = newSon("Tom", 15);son.address= "金水区";son.school= "九中";son.tel= "66123456";son.out();}}
考题内容:
阅读以下程序,给出程序的输出结果。public?class?Father {String name, address, tel;int?age;?public?Father(String name, int?age) {this.name?= name;this.age?= age;}?void?out() {System.out.print("姓名:"?+ name);System.out.print(" 年龄:"?+ age);}?void?outOther() {System.out.print(" 家庭住址:"?+ address);System.out.print(" 电话:"?+ tel);}}?class?Son extends?Father {String school;?public?Son(String name, int?age) {super(name, age);}?void?out() {super.out();super.outOther();System.out.println(" 学校:"?+ school);}?public?static?void?main(String args[]) {Son son = new?Son("Tom", 15);son.address?= "金水区";son.school?= "九中";son.tel?= "66123456";son.out();}}
阅读以下程序,给出程序的输出结果。publicclassFather {String name, address, tel;intage;publicFather(String name, intage) {this.name= name;this.age= age;}voidout() {System.out.print("姓名:"+ name);System.out.print(" 年龄:"+ age);}voidoutOther() {System.out.print(" 家庭住址:"+ address);System.out.print(" 电话:"+ tel);}}classSon extendsFather {String school;publicSon(String name, intage) {super(name, age);}voidout() {super.out();super.outOther();System.out.println(" 学校:"+ school);}publicstaticvoidmain(String args[]) {Son son = newSon("Tom", 15);son.address= "金水区";son.school= "九中";son.tel= "66123456";son.out();}}
考题内容:
阅读以下程序,给出程序的输出结果。public?class?Father {String name, address, tel;int?age;?public?Father(String name, int?age) {this.name?= name;this.age?= age;}?void?out() {System.out.print("姓名:"?+ name);System.out.print(" 年龄:"?+ age);}?void?outOther() {System.out.print(" 家庭住址:"?+ address);System.out.print(" 电话:"?+ tel);}}?class?Son extends?Father {String school;?public?Son(String name, int?age) {super(name, age);}?void?out() {super.out();super.outOther();System.out.println(" 学校:"?+ school);}?public?static?void?main(String args[]) {Son son = new?Son("Tom", 15);son.address?= "金水区";son.school?= "九中";son.tel?= "66123456";son.out();}}
参考答案: