• 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();
    
    
        }
    }
    
    
    
     
  • 相关阅读:
    观察者模式股票提醒
    中介者模式虚拟聊天室
    模板方法模式数据库的连接
    职责链模式财务审批
    期末总结
    软件需求分析考试
    tomcat启动极其慢的解决方法困扰我一年多的问题终于解决
    状态模式银行账户
    解释器模式
    动态加载JS文件提升访问网站速度
  • 原文地址:https://www.cnblogs.com/zhouxiaoyue/p/14170989.html
Copyright © 2020-2023  润新知