public class InterfaceExtends implements C
{
public void person (String str)
{
System.out.println("This Person is :"+str+"!");
}
public void student (String str)
{
System.out.println("This Student is :"+str+"!");
}
public void teacher (String str)
{
System.out.println("This Teacher is :"+str+"!");
}
public static void main(String args[])
{
InterfaceExtends inter=new InterfaceExtends();
inter.person("MaKin");
inter.student("Lily");
inter.teacher("John");
}
}
interface A
{
void person(String str);
}
interface B
{
void student(String str);
}
interface C extends A,B
{
void teacher(String str);
}
类是单继承的,但是接口是可以多继承的
最新推荐文章于 2022-06-19 10:38:14 发布