学习日志————java继承多态抽象接口代码(07)

第七天

package day7;

public abstract class Animal {
   public abstract void test();
   public abstract void move();
   
}
class Dog extends Animal{
	public void test() {
		
	}
	public  void move() {
		
	}
}
class Fish extends Animal{
	 public void test() {
		 
	 }
	 public void move() {
		 
	 }
}
abstract class Bird extends Animal{
	public abstract void test();
	public void move() {
		
	}
}

package day7;

public class CommonEmployee extends Employee{
      @Override
    public void work() {
    	// TODO Auto-generated method stub
    	System.out.println("putongyuangong");
    }
      public static void main(String[] args) {
		  Manager m=new Manager();
		  m.setSalary(5);
		  m.bonus=5;
		  m.work();
		  long start =System.currentTimeMillis();
	}
}

package day7;
/*
 * 
 * chuyi
 * 
 * */
public interface Cooking {
     void fry();
}

package day7;

public abstract class Employee {
	private String name;
	private int id;
	private int salary;
	public Employee(){}
	public abstract void work();
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public int getSalary() {
		return salary;
	}
	public void setSalary(int salary) {
		this.salary = salary;
	}
    
}

package day7;

public class Manager extends Employee {
      int bonus;
      public void work() {
    	  
    	  int sum=getSalary()+bonus;
    	  System.out.println("老板工资是:"+sum);
    	  
      }
}

package day7;

public abstract class Person {
   int age;
   String name;
   int sex;
  public abstract void showInfo();   
}

package day7;
/*
 * 
 *zhshi 
 * 
 * 
 * */
public class SCTeacher extends Person implements Cooking,Sing {
    String course;
    
    public void setInfo() {
    	super.age=24;
    	super.name="asda";
    	super.sex=1;
    	this.course="dasda";
    }
	public void showInfo() {
    	 System.out.println("会唱歌的出自老师信息是:");
    	 System.out.println(super.age);
    	 System.out.println(super.name);
    	 System.out.println(super.age);
    	 System.out.println(this.course);
     }
	@Override
	public void fry() {
		System.out.println(super.name+"老师厨艺是炒菜");
		
	}
	@Override
	public void singing() {
		System.out.println( super.name+"老师擅长的是美声唱法");
		
	}
}

package day7;

public interface Sing {
   void singing();
}

package day7;

public class Test {
     public static void main(String[] args) {
		  SCTeacher s=new SCTeacher();
		  s.setInfo();
		  s.showInfo();
		  s.fry();
		  s.singing();
	}
      
}

package day7;

public interface Test1 {
   int id=1;
   void test1();
}

package day7;

public interface Test2 {
    void test2();
}

你可能感兴趣的:(学习日志————java继承多态抽象接口代码(07))