0% found this document useful (0 votes)
3 views2 pages

Inheritance in Java

The document presents a Java program that demonstrates the concept of inheritance through two classes: Admission and Result. The Result class extends Admission and includes methods for inputting and displaying student information such as roll number, class, and marks. The program utilizes a Scanner for user input and displays the collected data on the console.

Uploaded by

Devbrat Singh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Inheritance in Java

The document presents a Java program that demonstrates the concept of inheritance through two classes: Admission and Result. The Result class extends Admission and includes methods for inputting and displaying student information such as roll number, class, and marks. The program utilizes a Scanner for user input and displays the collected data on the console.

Uploaded by

Devbrat Singh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Inheritance in java 30-07-2024

(Devbrat_Singh)

/*A java program to implement Inheritance*/

import [Link];

class Admission

int roll;

int Class;

class Result extends Admission

int marks;

void input()

Scanner sc = new Scanner([Link]);

[Link]("Enter Roll: ");

roll=[Link]();

[Link]("Enter Class: ");

Class=[Link]();

[Link]("Enter Marks: ");

marks=[Link]();
}

void display()

[Link]("Roll :"+roll);

[Link]("Class:"+Class);

[Link]("Marks: "+marks);

void main()

Result stu1= new Result();

[Link]();

[Link]();

You might also like