Question: Java Programming Tutorial OOP Exercises 1. Exercises on Classes 1.1 Ex: The Perimeter Class This exercise shall lead you through using this() this() is used


Java Programming Tutorial OOP Exercises 1. Exercises on Classes 1.1 Ex: The Perimeter Class This exercise shall lead you through using this() "this()" is used to access one constructor from another "within the same class'" Rules of using this() A few restrictions exist for the usage of this). 1. If included, this) statement must be the first one in the constructor. You cannot write anything before this() in the constructor. 2.With the above rule, there cannot be two this() statements in the same constructor (because both cannot be the first). 3.this() must be used with constructors only, that too to call the same class constructor (but not super class constructor). Exercise: Write the Perimeter Java Source Code with the definition of three constructors default, one parameter and two parameters constructors. Write its DRIVER CLASS with only one object. Initialize the class object with two values 10 and 20. The purpose of the class is: 1- Print out the default message from default constructor. 2- Print the perimeter of the circle from second constructor. 3- Print the perimeter of the Rectangle from third constructor
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
