Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Java messing around
// Start with Box. class Box { private double width; private double height; private double depth; // Construct clone of an object Box(Box ob) { //pass object to constructor width = ob.width; height = ob.height; depth = ob.depth; } // constructor used when all dimensions specified Box(double w, double h, double d) { width = w; height = h; depth = d; } // constructor used when no dimensions specified Box() { width = -1; // use -1 to indicate height = -1; // an uninitialized depth = -1; // box } // constructor used when cube is created Box(double len) { width = height = depth = len; } // compute and return volume double volume() { return width * height * depth; } } // Add weight class BoxWeight extends Box { double weight; // weight of box // construct clone
run
|
edit
|
history
|
help
0
CRUD vehicules
First Interview question - Java
SalesmenEarnings
This code is not what it seems...
Game developer
2b
클래스의 정의와 인스턴스 생성
2A
sfr
RevArray