其他分享
首页 > 其他分享> > TestInterface

TestInterface

作者:互联网

接口(重点)

9.1接口的定义

9.2接口的实现

Shape接口:

public interface Shape {
    void area();
    void perimeter();
}

 

Circle类实现Shape接口:

class Circle implements Shape1{
    @Override 
    public void area() { 
        System.out.println(4*4*3.14);
    } 
}
public interface SuperShape{}
​
public interface Shape extends SuperShape{}
class Circle implements SuperShape,sape{}

 

9.3接口和抽象类的区别

标签:实现,接口,TestInterface,Shape,interface,Circle,public
来源: https://www.cnblogs.com/txy1126/p/16084589.html