JAVA 小白 把一个Student类封装起来,模拟一个转校生转入新学校后为其制作学生信息的过程

本文通过JAVA编程,介绍如何封装一个Student类,详细阐述在转校生转入新学校的情景下,如何使用该类来创建和管理学生信息,包括姓名、年级、科目成绩等关键数据。
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);
        }
    }
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值