Only allow the heroname as a parameter for the constructor


Solve this programming problem:

The constructor should contain the subsequent (you can place it below the first one):

- Only allow the heroName as a parameter for the constructor

- Use the same code for defining the numberOfHeroes and the numberOfLifeChances

- Set the heroName attribute to the parameter passed into the constructor

- Set the secretIdentity to "unknown"

- Set numberOfPeopleSaved to 0

When this part is completed, you will have a SuperHero class with two constructors. The subsequent calls will be valid calls to one of the constructors:

SuperHero hero1 = new SuperHero("Superman", "Clark", 1000);

SuperHero hero2 = new SuperHero("Batman");

Answer this question and show each and every step with example.

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Only allow the heroname as a parameter for the constructor
Reference No:- TGS0952714

Expected delivery within 24 Hours