求Box体积和面积的java小程序计算机等级考试

文章作者 100test 发表时间 2010:01:01 12:30:00
来源 100Test.Com百考试题网


  class Box{

  double width.

  double height.

  double depth.

  public Box(double w,double h,double d){

  width=w.

  height=h.

  depth=d.

  }

  void getBox(){

  System.out.println("The width of Box is :" width).

  System.out.println("the heigth of Box is :" height).

  System.out.println("The depth of Box is :" depth).

  }

  void volume(){

  System.out.println("The volume of Box is:" (width*height*depth)).

  }

  void area(){

  System.out.println("The area of Box is :" 2*(width*height width*depth height*depth)).

  }

  }

  public class BoxDemo {

  public static void main(String args[]){

  Box box=new Box(5,2,5).

  box.getBox().

  box.volume().

  box.area().

  }

  }

  将Java代码打包为exe文件

  总结Java标准类库中类型相互转化的方法



相关文章


javaSwing组件大全超牛的例子计算机等级考试
Java获得文件编码格式计算机等级考试
java实现彩色图转变为灰度图计算机等级考试
java小代码计算矩形的面积和周长计算机等级考试
求Box体积和面积的java小程序计算机等级考试
将Java代码打包为exe文件计算机等级考试
利用Java查询Jar包内的驱动类名计算机等级考试
20个非常有用的Java程序片段(2)计算机等级考试
20个非常有用的Java程序片段(1)计算机等级考试
澳大利亚华人论坛
考好网
日本华人论坛
华人移民留学论坛
英国华人论坛