package com.yby5;
/*本类用于面向接口编程*/
public class InterfaceTest {
public static void main(String[] args) {
CGBTeacher ct = new CGBTeacher();
ct.ready();
ct.teach();
}
}
//1.创建老师接口--接口是先天设计的结果,最先设计的就是接口,要制定规则
interface Teacher{
//2.定义接口里的方法
void teach();//授课方法
void ready();//备课方法
}
class CGBTeacher implements Teacher{
@Override
public void teach() {
System.out.println("授课电商项目");
}
@Override
public void ready() {
System.out.println("备课电商项目");
}
}
class ACTTeacher implements Teacher{
@Override
public void teach() {
System.out.println("正在授课基础加强+框架加强");
}
@Override
public void ready() {
System.out.println("正在备课基础加强+框架加强");
}
}
abstract class SCDTeacher implements Teacher{
@Override
public void ready() {
System.out.println("正在研发新课程。。。");
}
}
|