Sahyadri Shikshan Santha’s
SAHYADRI POLYTECHNIC SAWARDE
MICRO PROJECT
ON
INHERITANCE
Submitted To
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
IN THE PARTIAL FULFILLMENT OF THE REQUIRMENT FOR DIPLOMA IN INFORMATION
ECHNOLOGY
SUBMITTED BY
Miss. Tanvi Ajit Pawar
Miss. Kumudini Shigwan
Miss. Shraddha Sanjay Wamane
UNDER THE GUINDANCE OF
Miss. Prachi Shinde
2023-2024
SAHYADRI POLYTECHNIC SAWARDE
MICRO PROJECT
INHERITANCE
Academic Year: 2023-2024
Program: Java Programing Program Code:
Course: Information Technology Course Code: If-4-I
Group Details:
TITLE OPROJECT: INHERITANCE
Sr Name of group members Roll Enrollment Number Seat
No Number Number
1 Miss. Tanvi Ajit Pawar 2523
2 Miss. Kumudini Shigwan 2524
3 Miss. Shraddha Sanjay Wamane 2525
Name of Guide: Miss. Prachi Shinde
MAHARASHTRA STATE BOARD TECHNICAL EDUCATION
Certificate
This is to certify that Miss. Tanvi Ajit Pawar
Miss. Kumudini Shigwan
Miss. Shraddha Sanjay Wamane
Of 3rd semester diploma in Computer Engineering / Information Technology of Sahyadri
polytechnic Sawarde (Code:0108) has completed the Micro Project satisfactory in subject Java
Programing for the academic year 2023-24 as prescribed in the curriculum.
Place: Sawarde Enrollment Number:
Date: _______________ Exam Seat No:
__________________
Subject Teacher HOD Principal
Micro Project Report
Title: Inheritance
1.0 Retionale:
Java, Inheritance is an important pillar of OOP (Object-Oriented Programming). It is the
mechanism in Java by which one class is allowed to inherit the features (fields and
methods) of another class. In Java, Inheritance means creating new classes based on
existing ones. A class that inherits from another class can reuse the methods and fields
of that class. In addition, you can add new fields and methods to your current class as
well.
2.0 Aims/Benefits of the Micro-Project:
Class : A class is a group of objects which have common properties. It is a template or
blueprint from which objects are created.
Sub Class/Child Class: Subclass is a class which inherits the other class. It is also
called a derived class, extended class, or child class.
Super Class/Parent Class: Superclass is the class from where a subclass inherits the
features. It is also called a base class or a parent class,
Reusability: As the name specifies, reusability is a mechanism which facilitates you to
reuse the fields and methods of the existing class when you create a new class. You
can use the same fields and methods already defined in the previous
3.0 Course Outcomes Achieved:
Inheritance is a fundamental concept in object-oriented programming, and it plays a crucial role
in Java. It allows programmers to create new classes based on existing classes, enabling code
reusability and organisation.
Inheritance refers to the process of transmission of genes from parent to offspring. Inheritance
is the passing on of genetic traits from parents to their offspring, and these offspring get all the
genetic information from their parents.
4.0 Literature review
One of the really useful features of Object-Oriented programming is inheritance. You may
have heard of someone coming into an inheritance, which often means they were left
something from a relative that died. Or, you might hear someone say that they have
inherited musical ability from a parent. In Java all classes can inherit object fields and
methods from another class. The class being inherited from is called the parent
class or superclass. The class that is inheriting is called the child class or subclass.
5.0 Actual Methodology Followed:
Introduction
Inheritance in Java is a mechanism in which one object acquires all the properties
and behaviors of a parent object. It is an important part of OOPS (Object Oriented
programming system).
The idea behind inheritance in Java is that you can create new classes that are built
upon existing classes. When you inherit from an existing class, you can reuse
methods and fields of the parent class. Moreover, you can add new methods and
fields in your current class also.
Inheritance represents the IS-A relationship which is also known as a parent-child
relationship.
Why use inheritance in java
For Method Overloading (so runtime polymorphisms can be achieved).
For Code Reusability.
The syntax of Java Inheritance
Class Subclass-name extends superclass-name
//method and fields
The extends keyword indicates that you are making a new class that derives from an
existing class. The meaning of "extends" is to increase the functionality. In the
terminology of Java, a class which is inherited is called a parent or superclass, and
the new class is called child or subclass
Inheritance Example
Base class
Class A
Extends
Class B Derived class
classclass
As displayed in the above figure, Programmer is the subclass and Employee is the
superclass. The relationship between the two classes is Programmer IS-A Employee.
It means that Programmer is a type of Employee.
Advantages Of Inheritance in Java:
1. Code Reusability: Inheritance allows for code reuse and reduces the amount of
code that needs to be written. The subclass can reuse the properties and methods
of the superclass, reducing duplication of code.
2. Abstraction: Inheritance allows for the creation of abstract classes that define a
common interface for a group of related classes. This promotes abstraction and
encapsulation, making the code easier to maintain and extend.
3. Class Hierarchy: Inheritance allows for the creation of a class hierarchy, which can
be used to model real-world objects and their relationships.
4. Polymorphism: Inheritance allows for polymorphism, which is the ability of an
object to take on multiple forms. Subclasses can override the methods of the
superclass, which allows them to change their behavior in different ways.
Types of inheritance
1) Single inheritance
2) Multilevel inheritance
3) Hierarchical inheritance
1) Single inheritance
When a class extends another one class only then we call it a single inheritance.
In case of single inheritance there is only a sub class and it’s parent class. It also called
simple inheritance or one level inheritance
Syntax
Class A
{
//members
}
Class B extends A
{
//members
}
Program
import [Link].*;
import [Link].*;
import [Link].*;
class One
{
public void print_geek()
{
[Link]("Geeks");
}
}
class Two extends One {
public void print_for() { [Link]("for"); }
}
public class Main {
public static void main(String[] args)
{
Two g = new Two();
g.print_geek();
g.print_for();
g.print_geek();
}
}
OUTPUT
Geeks
for
Geeks
2) Multilevel inheritance
We can create any layers in the inheritance as we want this is called multilevel
inheritance. This hierarchy can be created at any level of inheritance. When sub class is
derived from a derived class then this mechanism is known as multilevel inheritance.
Syntax
Class A
//methods
Class B extends A
//methods
Class C extends A
//methods
}
Program:
class Bird {
void fly() {
[Link]("I am a Bird");
class Parrot extends Bird {
void whatColourAmI() {
[Link]("I am green!");
class SingingParrot extends Parrot {
void whatCanISing() {
[Link]("I can sing Opera!");
class Main {
public static void main(String args[]) {
SingingParrot obj = new SingingParrot();
[Link]();
[Link]();
[Link]();
}
OUTPUT
I can sing Opera!
I am green!
I am a Bird
3) Hierarchical inheritance
When a class has more than one child classes have the same parent class then such
kind of inheritance is known as hierarchical inheritance. In case of hierarchical
inheritance we derived more than one subclass from a single super class
Syntax
Class A
//methods
Class B extends class A
//methods
Class C extends class A
//methods
}
Program
class Bird {
void fly() {
[Link]("I am a Bird");
class Parrot extends Bird {
void whatColourAmI() {
[Link]("I am green!");
class Crow extends Bird {
void whatColourAmI() {
[Link]("I am black!");
class Main {
public static void main(String args[]) {
Parrot par = new Parrot();
Crow cro = new Crow();
[Link]();
[Link]();
[Link]();
[Link]();
OUTPUT
I am green!
I am a Bird
I am black!
I am a Bird
6.0- Actual Resources Used:
Sr
Name of Resource/ Material Specification QTY Remark
No
Computer system Computer i3
1) Minimum 2GB ram
Software Jdk 1.8.0
2)
3)
Evaluation Sheet for the Micro Project
Name of Student :-_Tanvi Ajit Pawar, Kumudini shigvan, shraddha Sanjay Wamane.
Enrollment No:-23151020784,85,86
Name of Program: Java programing Semester: IV
Course Title:-Information technology Code: IF-4-I
Title of Micro Project:-Inheritance
Course Outcomes Achieved:
a)_______________________________________________________
b) _______________________________________________________
c) _______________________________________________________
d) _______________________________________________________
Average Excellent
Sr Poor Good
Characteristics to be assessed (Marks4- (Marks 9-
No (Marks 1-3) (Marks 6-8)
5) 10)
1 Relevance to the course
2 Literature survey / Information collection
3 Completion of the target as per project proposal
4 Analysis of data and representation
5 Quality of prototype / Model
6 Report Presentation
(A) Process and Product Assessment (Convert above total marks out of 6 marks)
8 Presentation
9 Viva
(B) Individual Presentation /Viva (Convert above total marks out of 4 marks)
(A)
(B) Individual Presentation / Viva Total
Process and Product Assessment
(4 marks) marks 10
(6 marks)
Comments/Suggestions above team work/leadership/inter-personal communication (if any)
____________________________________________________________________________
____________________________________________________________________________
__________________
Name and designation of the Teacher:-
_____________________________________________________
Dated Signature:-
______________________________________________________________________