method overloading and method overriding in java | polymorphism in java

  Рет қаралды 526

Smart Engineer

Smart Engineer

Күн бұрын

Polymorphism is an oops concept
poly means many and morphism means forms - so many forms
by method over loading and method over riding we can achieve polymorphism in java
method overloading is compile time polymorphism
method overriding is run time polymorphism
METHOD OVERLOADING
------------------------------------------
method over loading can be achieved by
changing number of parameters of method
changing data type of parameter
Note: we can't achieve method over loading by changing return type of method
automatic promotion happens
byte - short - int -long - float - double
char - int
when parent class and child class data types are there child class data type method will get priority
if both data types are of child class then we get ambiguity error
METHOD OVERRIDING
------------------------------------------
When child class is not satisfied with parent class implementation then child class can over ride parent class method
whatever method parent class has by default available to child class through inheritance, if child class not satisfied with parent class implementation then child is allowed to redefine the method based on its requirements. This process is called method overriding
The parent class method is called 0ver ridden method
the child class method is called over riding method
In overriding method resolution always takes care by JVM based on run time object and hence overriding is also considered as run time polymorphism or dynamic polymorphism or late binding.
In overloading method resolution always take care by compiler based on reference type so it is called compile time polymorphism
Note: In method over riding method signature should be same
00:10 method over loading by changing number of parameter
03:22 by changing data type of parameter
04:38 by changing return type of method ?
05:43 automatic promotion in method overloading
07:19 parent and child class data type
10:41 method overriding
13:12 super keyword
Follow me on Instagram
/ smart_engineer_youtube

Пікірлер: 1
@pranavsnair2467
@pranavsnair2467 Жыл бұрын
Super sir. Please upload more videos 🔥
this keyword in java
4:40
Smart Engineer
Рет қаралды 407
java user input | java output | java output formatting
15:49
Smart Engineer
Рет қаралды 291
Help Me Celebrate! 😍🙏
00:35
Alan Chikin Chow
Рет қаралды 60 МЛН
Когда отец одевает ребёнка @JaySharon
00:16
История одного вокалиста
Рет қаралды 2,3 МЛН
My Daughter's Dumplings Are Filled With Coins #funny #cute #comedy
00:18
Funny daughter's daily life
Рет қаралды 8 МЛН
#52 Method Overriding in Java
7:57
Telusko
Рет қаралды 144 М.
#25 Method Overloading in Java
6:03
Telusko
Рет қаралды 207 М.
The Value of Source Code
17:46
Philomatics
Рет қаралды 53 М.
Java OOP in 10 Minutes (Java Object Oriented Programming) #95
10:05
operators in java
36:08
Smart Engineer
Рет қаралды 644
Polymorphism In Java (Part 1) ||  Method Overloading in Java
40:20
Smart Programming
Рет қаралды 722 М.
Being Competent With Coding Is More Fun
11:13
TheVimeagen
Рет қаралды 87 М.
Help Me Celebrate! 😍🙏
00:35
Alan Chikin Chow
Рет қаралды 60 МЛН