作业零号

package com.Boxone;

public class Boxone {
    public static void main(String[] args){
        Box[] A = new Box[3];
        A[0] = new Box(2,2,2);
        A[1] = new Box(2,3,4);
        A[2] = new Box(9,8,7);
        for(Box e : A){
            e.ShowBox();
        }
    }
}

class Box{
    private int length;
    private int width;
    private int height;

    public Box( int length , int width , int height){
        this.length = length;
        this.width = width;
        this.height = height;
    }

    public void ShowBox(){
        System.out.println("lengh="+length+'t'+"width="+width+'t'+"height="+height);
    }
}

example1