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

Java Single Inheritance & Method Overriding

The document outlines an experiment to implement single inheritance and demonstrate method overriding in Java. It provides the necessary software requirements, an algorithm, and a sample program code. The result confirms the successful execution of the experiment.

Uploaded by

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

Java Single Inheritance & Method Overriding

The document outlines an experiment to implement single inheritance and demonstrate method overriding in Java. It provides the necessary software requirements, an algorithm, and a sample program code. The result confirms the successful execution of the experiment.

Uploaded by

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

Java Laboratory Record

EXP NO: 04-A - IMPLEMENT SINGLE INHERITANCE AND DEMONSTRATE


USE OF METHOD OVERRIDING

AIM:
To implement single inheritance and to demonstrate use of method overriding.

SOFTWARE REQUIRED:
 - A PC with Windows
 - JDK 1.6

ALGORITHM:
1. Create a class named 'student' with a method 'detalis' that prints 'psg polytechnic
college'.
2. Create a class named 'deparment' that extends the 'student' class.
3. Override the 'detalis' method in the 'deparment' class to print 'computer networking'.
4. In the 'Exp4a' class's main method: Create objects: 'student', 'deparment', 'student1'.
Call the 'detalis' method on each object.
5. End of the program.

PROGRAM:
class student {
public void detalis() {
[Link]("psg polytechnic college");
}}
class deparment extends student {
@Override
public void detalis() {
[Link]("computer networking");
}}
public class Exp4a {
public static void main(String[] args) {
student student = new student();
[Link]();
deparment deparment = new deparment();
[Link]();
student student1 = new deparment();
[Link]();
}
}
RESULT:
Thus, we have successfully implemented single inheritance and demonstrated the use of
method overriding.

You might also like