-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBox.java
More file actions
56 lines (42 loc) · 1010 Bytes
/
Copy pathBox.java
File metadata and controls
56 lines (42 loc) · 1010 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**
* Program that uses Box Class.
*
*/
package JavaCompleteReference;
class Box1
{
int width;
int height;
int depth;
}
public class Box {
public static void main(String[] args) {
// TODO Auto-generated method stub
/**
* Creating Object mybox
*/
Box1 mybox=new Box1();
/**
* Creating a new Box2
*/
Box1 mybox1 = new Box1();
mybox.width=112;
mybox.depth=100;
mybox.height=110;
mybox1.width=12;
mybox1.depth=10;
mybox1.height=10;
/**
* Computing the two volumes of both boxes
*/
double Volume=mybox.width*mybox.depth* mybox.height;
double Volume2=mybox1.width*mybox1.depth*mybox1.height;
/*
* Displaying output and mybox1 and mybox
*/
System.out.println("Volume of the box is " +Volume);
System.out.println("Volume of the box is " +Volume2);
System.out.println("address of mybox " +mybox);
System.out.println("address of mybox is " +mybox1);
}
}