You are on page 1of 3

EXPERIMENT NO: 2.

NAME : PALLAVI KUMARI


UID : 20BCS5485
SECTION : 20BCS48B

Write a program to differentiate between method overloading and


method overriding.

METHOD OVERLOADING :

If a class has multiple methods having the same name but different in
parameters, it is known as Method Overloading.

CODE :
OUTPUT:

METHOD OVERRIDING :

If a subclass (child class) has the same method as declared in the parent
class, it is known as method overriding in Java.
CODE :

OUTPUT:

You might also like