Class 12 ISC JAVA || Inheritance Program in Java

Опубликовано: 23 Июль 2026
на канале: Alex Sir
612
16

A superclass Record contains names and marks of the students in two different single dimensional arrays. Define a subclass Highest to display the names of the students obtaining the highest mark

The details of the members of both classes are given below:
Class name: Record
Data member/instance variable:
n[] : array to store names
m[]: array to store marks
size: to store the number of students

Member functions/methods:
Record(int cap): parameterized constructor to initialize the data member
size = cap
void readarray() : to enter elements in both the arrays
void display() : displays the array elements

Class name: Highest
Data member/instance variable:
ind: to store the index

Member functions/methods:
Highest(…): parameterized constructor to initialize the data members of both the classes
void find(): finds the index of the student obtaining the highest mark and assign it to ‘ind’
void display(): displays the array elements along with the names and marks of the students who have obtained the highest mark

Assume that the superclass Record has been defined. Using the concept of inheritance, specify the class Highest giving the details of the constructor(…), void find() and void display().

The superclass, main function and algorithm need NOT be written.