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

Java OOP Assignment: Inheritance & Interfaces

The document outlines an assignment for a Java programming course, detailing various tasks related to object-oriented concepts. It includes creating classes, implementing inheritance, designing abstract classes, and demonstrating access protection and interfaces. Each task requires writing specific Java programs with provided class structures and methods.

Uploaded by

Manraj 55
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 views18 pages

Java OOP Assignment: Inheritance & Interfaces

The document outlines an assignment for a Java programming course, detailing various tasks related to object-oriented concepts. It includes creating classes, implementing inheritance, designing abstract classes, and demonstrating access protection and interfaces. Each task requires writing specific Java programs with provided class structures and methods.

Uploaded by

Manraj 55
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

Assignment 9

Name: Jay Patel


Enrollment no : 23ID01IT044
Subject :Object Oriented Concept & Programming
1) Create a Java program called Person_Faculty.java. Create a class Person with data
members name, birth date and gender. Create another class faculty that inherits
from class Person with data member title that holds values such as “assistant
professor” or “professor”. Include a constructor and get and display methods for
titles

Code:
Output:
1) Write a program to implement hierarchical inheritance using mobile phone. Following are the
details to conduct.

- Base class

 Mobile
 Method
 spowerTurnON(),powerTurnOFF()
- Sub-class
 Xiome, Samsung, viv
 ovolumeUp(), volumeDown()

Code:
Output:
2) Create a Java program [Link] to demonstrate the following Multiple
inheritance. Assume suitable data.

Code:
Output:

3) Write a program to design an abstract class.


Code:

Output:
4) Write a program to create and import a Package.
Code:

Output:

5) Write a program to demonstrate access protection within the other Package.

Code:
Package :Another Package

[Link]

Output:

6) Write a program to demonstrate access protection within the same Package.

Code:
[Link]

Output:
7) Write a program in to design an interface.

Code:

[Link]

[Link]
[Link]

Output:
8) Write a java program to implement an interface for Vehicles Consider the example of vehicles
like bicycle, car and bike. All Vehicles have common functionalities such as Gear Change, Speed
up and apply breaks. Make an interface and put all these common functionalities. Bicycle, Bike,
Car classes should be implemented for all these functionalities in their own class in their own
way.

Code:

[Link]

[Link]
[Link]
Output:
9) Write a java program to demonstrate to difference between class and interface.

Code:

[Link]
[Link]

[Link]

[Link]

[Link]
[Link]

Output:

You might also like