河南成教 / JAVA面向对象程序设计
2、
以下程序的输出结果_______________。。 publiccclasssFatherr{{{Stringgname,,address,,tel;;;inttage;; publiccFather(Stringgname,,inttage){{{{this.namee==name;;;;this.agee==age;; }} voiddout(){{ System.out.print("姓名:"" name);; System.out.print(""年龄:"" age);;;}} voiddoutOther(){{{{ System.out.print(""家庭住址:"" address);;;;System.out.print(""电话:"" tel);;;}} }}} classsSonnextendssFatherr{{{Stringgschool;; publiccSon(Stringgname,,inttage){{{{super(name,,age);;;}} voiddout(){{{{super.out();;;; super.outOther();; System.out.println(""学校:"" school);;;}} publiccstaticcvoiddmain(Stringgargs[]){{{{Sonnsonn==newwSon("Tom",,15);;;;son.addresss=="金水区";;;;son.schooll=="九中";;;;son.tell=="66123456";;;;son.out();;;}}
2、
以下程序的输出结果_______________。。 publiccclasssFatherr{{{Stringgname,,address,,tel;;;inttage;; publiccFather(Stringgname,,inttage){{{{this.namee==name;;;;this.agee==age;; }} voiddout(){{ System.out.print("姓名:"" name);; System.out.print(""年龄:"" age);;;}} voiddoutOther(){{{{ System.out.print(""家庭住址:"" address);;;;System.out.print(""电话:"" tel);;;}} }}} classsSonnextendssFatherr{{{Stringgschool;; publiccSon(Stringgname,,inttage){{{{super(name,,age);;;}} voiddout(){{{{super.out();;;; super.outOther();; System.out.println(""学校:"" school);;;}} publiccstaticcvoiddmain(Stringgargs[]){{{{Sonnsonn==newwSon("Tom",,15);;;;son.addresss=="金水区";;;;son.schooll=="九中";;;;son.tell=="66123456";;;;son.out();;;}}
参考答案:
佳题速递: