Java第2版第7章(阅读).pptVIP

  • 14
  • 0
  • 约 72页
  • 2016-12-11 发布于重庆
  • 举报
Windows98 汕头大学计算机教学中心 class Cylinder {public Cylinder(){// initialise instance variablesx = 0;}public int sampleMethod(int y){// put your code herereturn x + y;}private double radius;private int height;private double pi=3.14;private String color;public double SetCylinder(double r, int h){radius=r;height=h;return r+h;}public void SetCylinder(String str){color=str;} public class App7_3 {public static void main(String[] args){double r_h;Cylinder volu=new Cylinder();r_h=volu.SetCylinder(2.5,5);volu.SetCylinder(红色);System.out.println(圆柱底和高之和=+r_h);System.out.println(圆柱体体积=+volu.volume());volu.show

文档评论(0)

1亿VIP精品文档

相关文档