blob: ab6f0dca1cff6b99ebf7b570f5bb19b9a93f2664 (
plain) (
blame)
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
|
public class SquareDemo {
public static void main (String args []) {
double leng = 2.5;
double value;
// create a circle object called mySquare with a lengius of 2.5
Square mySquare = new Square(leng);
// create a circle object called myOtherSquare with a lengius of 10.0
Square myOtherSquare = new Square(10);
// create a circle object called unitSquare with a default lengius of 1.0;
Square unitSquare = new Square();
// create a circle object called myLastSquare that is a copy of the Square mySquare
Square myLastSquare = new Square(mySquare);
// get the area of mySquare
value = mySquare.area();
// print the area of mySquare
System.out.println("The area is " + value);
}
}
|