summaryrefslogtreecommitdiffstats
path: root/Java/Square/SquareDemo.java
diff options
context:
space:
mode:
authormsglm <msglm@techchud.xyz>2023-01-14 05:31:48 -0600
committermsglm <msglm@techchud.xyz>2023-01-14 05:31:48 -0600
commit9d53d8857eaa1c9405894a88ca75bc4657e42f35 (patch)
treeeb1efc1d028b949dd83bb710c68be8eff58f26e7 /Java/Square/SquareDemo.java
downloadschool-code-master.tar.gz
school-code-master.tar.bz2
school-code-master.zip
Inital CommitHEADmaster
Diffstat (limited to 'Java/Square/SquareDemo.java')
-rw-r--r--Java/Square/SquareDemo.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/Java/Square/SquareDemo.java b/Java/Square/SquareDemo.java
new file mode 100644
index 0000000..ab6f0dc
--- /dev/null
+++ b/Java/Square/SquareDemo.java
@@ -0,0 +1,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);
+
+ }
+}
+