Write a sample class called inheritQuestion that extends the

Write a sample class called inheritQuestion that extends the class extendClass. Add a constructor that initializes an int variable called initial to -1. The constructor should call the parent constructor before doing anything else.

Solution

inheritQuestion.java


public class inheritQuestion extends extendClass{//extendsing the class extendClass
   private int initial; //declaring int variable
   public inheritQuestion(){
       super(); //calling parent class constructor
       initial = -1; //initializing initial variable to -1
   }
}

Write a sample class called inheritQuestion that extends the class extendClass. Add a constructor that initializes an int variable called initial to -1. The con

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site