java程序设计 应急,各位大侠帮帮忙

[复制链接]
查看11 | 回复1 | 2009-6-12 14:39:23 | 显示全部楼层 |阅读模式
继承人类编写一个学生类,测试继承过来的属性和方法,并提供其它构造函数,并完成如下要求:
(1)使用人类的构造函数参数格式实例化一个学生
(2)在学生类的构造函数中调用人类的构造函数。

回复

使用道具 举报

千问 | 2009-6-12 14:39:23 | 显示全部楼层
//子类public class Student extends People {Student() {
System.out.println("s1");}Student(int iage, String strname) {
this.age = iage;
this.name = strname;}}//父类public class People {int age;String name;People(){
System.out.println("p1");}public static void main(Str...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行