A Java class may have more than one constructor. Usually the assignments made in each constructor overlap. To eliminate redundant assignment statements, the developer can call another constructor by using the
this keyword. To write a program that uses
this in this manner, follow these seven steps.
Two constructors are defined. The second constructor calls the first one to avoid a redundant statement that assigns last name to the input parameter.
Two Person objects are instantiated. The second object is created using the constructor that calls another constructor using