// Konstruktor parameetritega class Box{ double width, height, depth; // Konstruktor Box-i jaoks Box( double w, double h, double d) { width = w; height = h; depth = d; } // Leiab ja tagastab ruumala double volume(){ return width * height * depth; } } class BoxDemo7 { public static void main(String args []) { // reserveerib mälu objektidele, väärtustab parameetrid Box mybox1 = new Box(10, 20, 15); Box mybox2 = new Box(3, 6, 8); System.out.println( "Ruumala.1 = " + mybox1.volume()); System.out.println( "Ruumala.2 = " + mybox2.volume()); } }