Question: public class Student extends Person { //Data Members private String StudentID; private String Course; private String Category; //Default Constructor public Student() { super(); this.StudentID =

public class Student extends Person {

//Data Members

private String StudentID;

private String Course;

private String Category;

//Default Constructor

public Student()

{

super();

this.StudentID = "Unknown";

this.Course = "Unknown";

this.Category = "Unknown";

}

//Non-default Constructor

public Student(String FN, String LN, int Age, String GN, String City, String SID, String Course, String Cat)

{

super (FN, LN, Age, GN, City);

this.StudentID = SID;

this.Course = Course;

this.Category = Cat;

}

public String toString()

{

String Print;

Print = " Student Details:" + super.toString() + " Student ID: " + this.StudentID + " Course: " + this.Course +

" Category: " + this.Category;

return Print;

}

}

Student Class

Consider student class as a sub class of Person

  1. What is the additional attribute that a student class can have?
  2. Discuss the different types of constructor that this class can have and how will you use Super keyword?
  3. Override the toString() method of person class which will display the all details of that particular person.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!