zoukankan      html  css  js  c++  java
  • java学习46天2020/8/20

    public class student1  {
    	protected String name;
    	protected int classid;
    	protected int id;
    	public student1(String str,int n,int m)
    	{
    		name=str;classid=n;id=m;
    	}
    	 public void move()
    	 {
    	  System.out.println("上课,学习");
    	 }
    	 public void display()
    	 {
    		 System.out.println("姓名"+name+" "+"班级"+classid+" "+"学号"+id);
    	 }
    }
    
    public class teacher extends student1{
    	protected  int tid;
    	protected int salary;
    	public teacher(String str,int k,int s,int n,int m)
    	{
    		super(str,k,s);
    	    tid=n;salary=m;
    	}
    	public void tmove()
    	 {
    		System.out.println("批改作业,备课,上课");
    	 }
    	 void tdisplay()
    	 {
    		 System.out.println("工号"+tid+" "+"工资"+salary);
    	 }
    	 public static void main(String [] args)
    	 {
    		 teacher m=new teacher("asd",5,001,0065,8000);
    		 m.move();
    		 m.tmove();
    		 m.display();
    		 m.tdisplay();
    		 
    		 
    	 }
    
    }
    

     

     二.使用super来引用父类构造函数

    三,例题

  • 相关阅读:
    spark实验四(2)
    spark实验四
    神奇的一天
    Spark实验三
    Scala实验任务三
    Scala实验任务二
    Scala语言实验任务一
    kettle的基本使用
    质量属性之安全性战术
    datax相关
  • 原文地址:https://www.cnblogs.com/qiangini/p/13583364.html
Copyright © 2011-2022 走看看