RUVIDEO
Поделитесь видео 🙏

Method Overriding in Java смотреть онлайн

📁 Лайфстайл 👁️ 16 📅 04.12.2023

1. Method Overriding in Java
2. Understanding the problem without method overriding
3. Can we override the static method
4. Method overloading vs. method overriding
======================================================


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

In other words, If a subclass provides the specific implementation of the method that has been declared by one of its parent class, it is known as method overriding.



Usage of Java Method Overriding
======================================================
1. Method overriding is used to provide the specific implementation of a method which is already provided by its superclass.

2. Method overriding is used for runtime polymorphism - we will see later


Rules for Java Method Overriding
======================================================
1. The method must have the same name as in the parent class
2. The method must have the same parameter as in the parent class.
3. There must be an IS-A relationship (inheritance). -

Understanding the problem without method overriding
======================================================
Let's understand the problem that we may face in the program if we don't use method overriding.






Example of method overriding
======================================================
In this example, we have defined the teach method in the subclass as defined in the parent class but it has some specific implementation. The name and parameter of the method are the same, and there is IS-A relationship between the classes, so there is method overriding.




A real example of Java Method Overriding
======================================================
Consider a scenario where Bank is a class that provides functionality to get the rate of interest. However, the rate of interest varies according to banks. For example, SBI, ICICI and AXIS banks could provide 8%, 7%, and 9% rate of interest.

Note: Java method overriding is mostly used in Runtime Polymorphism which we will learn in next session.




Can we override static method?
======================================================
No, a static method cannot be overridden. It can be proved by runtime polymorphism, so we will learn it later. - PROOF BY CODE



Why can we not override static method?
======================================================
It is because the static method is bound with class whereas instance method is bound with an object.

Can we override java main method?
======================================================
No, because the main is a static method.


More topics on Method Overriding (Not For Beginners)
======================================================
1. Method Overriding with Access Modifier
2. Exception Handling with Method Overriding

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Method Overriding in Java» бесплатно и без регистрации, вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.