首页 > > 详细

讲解留学生Cylinder Java语言、Java Face 编程解析、辅导Java编程、Java编程调试

//filename:Cylinder.java
interface Face1
{
final double PI=3.14;
abstract double area();
}
interface Face2
{
abstract void setColor(string c);
}
interface Face3 extends Face1,Face2
}
abstract void volume;
}
public class Cylinder implements Face3
{
private double radius;
private int height;
protected string color;
public Cylinder(double r,int h)
{
radius=r;
height=h;
}
public double area()
{
return PI*radius*radius;
}
public void setColor(String c)
{
color=c;
System.out.println(":"=color);
}
public void volume()
{
System.out.println("="+area()*height);
}
public static void main(String[]args)
{
Cylinder volu=new Cylinder(8.0,2);
volu.setColor("");
volu.volume();
}
}

 

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!