Lesson 37 Compile time Polymorphism - Method, Constructor and Operator + Overloading

Опубликовано: 01 Январь 1970
на канале: JavaJourneyWithMadhavi
83
3

In this video, Method overloading is explained with the help of Area program which has 3 methods, Addition program with 8 methods, Operator class to explain operator + over loading, and Time class to show constructor overloading.

Link to the Book - Essentials of Computer Applications:

https://www.amazon.in/Essentials-Comp...


Method Overloading Practice exercise:

Call the methods in main method – first two questions using object, and last two static

1. Create a class called Volumes with three methods which displays the
volume of cube ( l * l * l),
volume of cuboid (l * b * h),
volume of a cylinder (πr2 h) using function overloading concept.

2. Create a class with three methods as follows:
void compare (String, String) // displays a larger string
void compare (int, int) // displays a larger number
void compare (char, char) // displays a character with a greater Unicode value.

3. Create a class with two methods to display the
perimeter of a square(4xa) and
perimeter of a rectangle(2(l+b)) using method overloading concept.

4. Create a class with two methods using method overloading concept.
convert (int hours) // converts hours to minutes
convert (int km, int m) // converts to meters and displays