public class Student
{
Backstage information = new Backstage();//创建后台查找系统
void Access (String mation)//查询信息
{
information.cooking(mation); //通知mation查询信息
}
void SaySorry()
{
System.out.println("查无此人");
}
public static void main(String[] args)
{
Student Reception = new Student();
System.out.println("查找李敖信息如下");
Reception.Access("\n");//查询信息如下
}
class Backstage //后台
{
String Studentnumber;//设置变量
String name;
String sex;
String place;
String phono;
Backstage()//定义变量
{
this.Studentnumber = "学号";
this.name = "姓名";
this.sex = "性别";
this.place = "籍贯";
this.phono = "父母的联系方式";
}
void cooking(String mation)//信息
{
System.out.println(Studentnumber+"26"+mation);
System.out.println(name+"李敖"+mation);
System.out.println(sex+"男"+mation);
System.out.println(place+"北京"+mation);
System.out.println(phono+"父:130xxxx1100"+mation);
}
}
}
JAVA 小白 把一个Student类封装起来,模拟一个转校生转入新学校后为其制作学生信息的过程
最新推荐文章于 2023-10-13 19:24:58 发布
本文通过JAVA编程,介绍如何封装一个Student类,详细阐述在转校生转入新学校的情景下,如何使用该类来创建和管理学生信息,包括姓名、年级、科目成绩等关键数据。

2万+

被折叠的 条评论
为什么被折叠?



