1.在程序中定义一个Student类,完善Student类的结构,创建对象幵使用。(熟悉类与对象、创建对
象)
classStudent
{
Stringname;
intage;
//定义一个整数属性chinese;
//定义一个整数属性math;
//定义一个整数属性english;
Student(Stringname,intage,intchinese,intmath,intenglish)
{
//根据传入参数,初始化属性变量。
}
inttotal()
{
//返回chinese,math,english的总和
}

Java程序基础,定义属性和对象的创建
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
2条回答 默认 最新
- CSDN专家-sinJack 2022-03-02 09:13关注
class Student { String name; int age; int chinese; int math; int english; Student(String name,int age,int chinese,int math,int english) { this.name=name; this.age=age; this.chinese=chinese; this.math=math; this.english=english; } int total() { return chinese+math+english; }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报 编辑记录