Java–教师类

Java–教师类packagecom.company;classteacher{intnumber;Stringname;Stringborndate;Stringsex;Stringworkplace;Stringposition;voidshow(){System

大家好,欢迎来到IT知识分享网。Java--教师类"


package com.company;
class teacher
{
    int number;
    String name ;
    String borndate ;
    String sex;
    String workplace ;
    String position ;

    void show()
    {
        System.out.print(+number+" ");
        System.out.print( name+" " );
        System.out.print( sex+" " );
        System.out.print( borndate+" " );
        System.out.print( position+" ");
        System.out.println( workplace+" " );
        System.out.print("研究 ");
        System.out.print("实验 ");
        System.out.print("行政 ");
        System.out.println("图书管理");
    }
}
class student extends teacher
{
    String grade;
    void show()
    {
        System.out.print(+number+" ");
        System.out.print( name+" " );
        System.out.print( sex+" " );
        System.out.print( borndate+" " );
        System.out.print( position+" ");
        System.out.print( grade+" " );
        System.out.println( workplace+" " );
        System.out.print("吃饭 ");
        System.out.print("学习 ");
        System.out.print("睡觉 ");
        System.out.println("看书");

    }
}
public class Main {

    public static void main(String[] args) {
        // write your code here
        teacher t = new teacher();
        student s = new student();
        t.borndate = ("2000/9/9");
        t.name = ("张三");
        t.number = 1195;
        t.position= "老师";
        t.sex="男";
        t.workplace="教师办公室";
        s.borndate = ("2018/9/9");
        s.name = ("李四");
        s.number = 1000;
        s.position= "学生";
        s.sex="男";
        s.workplace="教室";
        s.grade="三年级";
        t.show();
        s.show();


    }
}


 

 

 

免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://yundeesoft.com/32811.html

(0)
上一篇 2023-12-02 09:33
下一篇 2023-12-02 15:45

相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注微信