• 2022-05-31
    阅读下列程序,写出程序运行的结果:class Cube{int width;int height;int depth;Cube(int x,int y,int z){this.width=x;this.height=y;this.depth=z;}public int vol(){return width*height*depth;}}public class UseCube {public static void main(String[] args) {Cube a=new Cube(3,4,5);System.out.println("长度="+a. width);System.out.println("体积="+a.vol());}}
  • 举一反三