一个java的编程题

[复制链接]
查看11 | 回复3 | 2009-6-24 21:42:51 | 显示全部楼层 |阅读模式
根据给出的代码框架,完善程序设计:定义一个类ConcreteClass,包括的成员变量有姓名,学号,分数,且此类中包括二个构造方法和一个打印输出学生姓名与成绩的方法。

(1) //类定义
{

String name;

String id;

int score;
(2) //接收三个参数的构造方法
(3) //接收姓名和学号二个参数的构造方法
(4) //方法:打印出学生的姓名与成绩
}

回复

使用道具 举报

千问 | 2009-6-24 21:42:51 | 显示全部楼层
public class ConcreteClass{ String name;
String id;
int score;
public ConcreteClass(String name,String id,int score)
{
this.name=name;
this.id=id;
this.score=score;
}
public ConcreteClass(String name,String id)
{
this.name=name;
this.id=id;
}
public ...
回复

使用道具 举报

千问 | 2009-6-24 21:42:51 | 显示全部楼层
public class ConcreteClass { // 成员变量 String name; String id; int score;// 接受三个参数的构造方法 public ConcreteClass(String _name, String _id, int _score) {name = _name;...
回复

使用道具 举报

千问 | 2009-6-24 21:42:51 | 显示全部楼层
public ConcreteClass(String name,String id,int score){ this.name = name; this.id= id; this.score= score;}public ConcreteClass(String name,String id){ th...
回复

使用道具 举报

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

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行