No video

8.7 Polymorphism in Java

  Рет қаралды 277,335

Telusko

Telusko

Күн бұрын

What is Polymorphism?
The ability of an object to take on many forms is known as polymorphism.
The word "poly" means many and "morphs" means behavior. So polymorphism means many behavior.
Types of polymorphism : compile time polymorphism and runtime polymorphism.
Check out our website: www.telusko.com
Follow Telusko on Twitter: / navinreddy20
Follow on Facebook:
Telusko : / teluskolearnings
Navin Reddy : / navintelusko
Follow Navin Reddy on Instagram: / navinreddy20
Subscribe to our other channel:
Navin Reddy : / @navinreddy
Telusko Hindi :
/ @teluskohindi
Subscribe to the channel and learn Programming in easy way.
Java Tutorial for Beginners : goo.gl/p10QfB
Scala Tutorials for Java Developers : goo.gl/8H1aE5
C Tutorial Playlist : goo.gl/8v92pu
Android Tutorial for Beginners Playlist : goo.gl/MzlIUJ
XML Tutorial : goo.gl/Eo79do
Design Patterns in Java : goo.gl/Kd2MWE
Socket Programming in Java : goo.gl/jlMEbg
Spring MVC Tutorial : goo.gl/9ubbG2
OpenShift Tutorial for Beginners : goo.gl/s58BQH
Spring Framework with Maven : goo.gl/MaEluO
Sql Tutorial for Beginners : goo.gl/x3PrTg
String Handling in Java : goo.gl/zUdPwa
Array in Java : goo.gl/uXTaUy
Java Servlet : goo.gl/R5nHp8
Exception Handling in Java : goo.gl/N4NbAW

Пікірлер: 208
@miguelunch4
@miguelunch4 6 жыл бұрын
Thank you so much, you make it so easy to learn. Even though it's obvious that you're an expert your explanations can be easily understood by beginners Seriously, thank you.
@anjaneyanaik761
@anjaneyanaik761 6 жыл бұрын
Best professor for Java 😍
@Icecodes
@Icecodes 5 жыл бұрын
I agree he needs a Udemy course.
@shobhitranjan2938
@shobhitranjan2938 3 жыл бұрын
@@Icecodes he have
@anaskala1196
@anaskala1196 6 жыл бұрын
I am wondering about my father's reaction, when I tell him that his mobile phone is my mobile phone.
@rajatpradhan9219
@rajatpradhan9219 5 жыл бұрын
Lol😆!!
@McLovinBillion
@McLovinBillion 4 жыл бұрын
That was probably the worst example of inheritence and polymorphism 😂😂😂
@chintanSharma29.02
@chintanSharma29.02 4 жыл бұрын
*Flying Chappal Appears*
@jhansiravipati1698
@jhansiravipati1698 4 жыл бұрын
HAHAHAHAH
@giorgi23
@giorgi23 3 жыл бұрын
As nowadays mobiles phones are almost our identity this is true, but in 2005 we could share our phones easily :))))
@dnyaneshwarkadam6823
@dnyaneshwarkadam6823 5 жыл бұрын
Navin sir lot's of thanks for opp's (polymorphism) concept... I understand this concept very simply because of you. Really thanks 😊.............
@RealNaps
@RealNaps 4 жыл бұрын
I LOVE THE EXAMPLE OF YOUR PHONE, IT MADE EVERYTHING CRIPSY
@knowledgeunlimited
@knowledgeunlimited 5 жыл бұрын
The way you explain make things and concepts easy to understand. Thank you sir, good one
@ekanshmishra4517
@ekanshmishra4517 3 жыл бұрын
One of the best explanation of such difficult topics.. thank you sir🙏
@mamtarani8331
@mamtarani8331 4 жыл бұрын
Omg finally method overriding concept is cleared.... Thank you so much sir for explaining with the easiest way
@SmartProgramming
@SmartProgramming 5 жыл бұрын
its really awesome feeling to watch your tutorial, very very helpful tutorial 👌👌👌👌🙂🙂🙂
@vladanulardzic5859
@vladanulardzic5859 4 жыл бұрын
Great practical examples. So simply explanation of Polymorphism I have never seen before... and very effective. Thank you very, very much. Great teacher you are. Regards.
@rikinshah5367
@rikinshah5367 6 жыл бұрын
He said "IF WE ARE HUMANS" means when he says "HELLO ALIENS" he actually means it lmao
@BigyanChap
@BigyanChap 6 жыл бұрын
I literally laughed for 1 minute straight as I read your comment.
@amanburnwal6151
@amanburnwal6151 6 жыл бұрын
i want someone to comment on this....lol
@kusumachallaa9876
@kusumachallaa9876 4 жыл бұрын
😁
@sulaimanabid5487
@sulaimanabid5487 4 жыл бұрын
He explained it very well highly recommended for java
@Nishant_0073
@Nishant_0073 4 жыл бұрын
Sir,concept is cleared Thank You So Much Sir.......!!!!!!!!!
@adityanjsg99
@adityanjsg99 4 жыл бұрын
Clear explanation. Budding Data Scientist, here for Java basics and more than happy.
@raamch
@raamch 2 жыл бұрын
Never bored of your voice! #javatutorial outstanding Tutor.
@juliet5446
@juliet5446 3 жыл бұрын
Best teacher I have come across
@dopenope4829
@dopenope4829 4 жыл бұрын
i love it, when some things slip out of his mind and for remembering them he keeps looking at the roof XD . TBH great teacher
@raamch
@raamch 2 жыл бұрын
He portray like a beginner how he/she thinks so that it connects to beginners. That’s a great way of teaching a complex topic like Java programming.
@ankushbanerjee8509
@ankushbanerjee8509 3 жыл бұрын
Great Examples everyone can relate easily😍😍
@sidramowlana
@sidramowlana 5 жыл бұрын
Understood perfectly thank you for the great explanation :)
@user-wo3ko1gh1u
@user-wo3ko1gh1u 10 ай бұрын
Watching this video today...nice explain and clear concepts easily while you teach. btw- who is coming while you teaching sir ? 🤣
@geethanjalibaskaran3028
@geethanjalibaskaran3028 5 жыл бұрын
Perfect example and I clearly learned the concepts.
@shreypatel920
@shreypatel920 6 жыл бұрын
You are really good at giving examples
@fareedahmedkhan9923
@fareedahmedkhan9923 3 жыл бұрын
Nice Explanation Sir, Literally got the whole concept and the examples also were superb Thank U 🤗
@mohamedhassan7849
@mohamedhassan7849 4 жыл бұрын
Actually it's very funny after i listen a full lecture and get nothing if not confuse hhhhhhhhhh but the time i watched this 9min lecture i got whole concept and am hereby thanking you brother. UNCOUNTERBLE THANKS MAN.
@smellydonut5088
@smellydonut5088 4 жыл бұрын
Thanks sm for this video! Definitely one of the best I've seen :)
@yaswanthmanikanta664
@yaswanthmanikanta664 4 жыл бұрын
best professor of java thank u sir for helping us
@nesaresar7898
@nesaresar7898 8 ай бұрын
However, POLYMORPHISM in Java means that a superclass reference variable can reference objects of a subclass. Overriding in a "is - a" relationship (Inheritance) means that a method in the subclass overrides the method with the same signature in the superclass. Consider the following example: 1. public class ClassA 2. public class ClassB extends ClassA POLYMORPHISM means you can do the following code: ClassA obj = new ClassB ();
@BeardAndBeans
@BeardAndBeans 4 жыл бұрын
java program that can maintain a list of items. It will display a menu with the functionality to add an item, and Display All Items (sorted in ascending order by price), and of course Exit.
@shankarprasadchatterjee4286
@shankarprasadchatterjee4286 4 жыл бұрын
Wonderful sir Who can make such complex concept so easily
@priyeshkaithvas3489
@priyeshkaithvas3489 Жыл бұрын
Best and easily explain this topic thankyou
@inji3570
@inji3570 5 жыл бұрын
Video voice quality is low, but your explanation is amazing
@mechnovashia
@mechnovashia 7 жыл бұрын
Nice Explanation. I request you to make a video on Aggregation concept too.
@kevinpatel5106
@kevinpatel5106 4 жыл бұрын
That was a great analogy, thank you for your help!
@shijilnarayan3889
@shijilnarayan3889 Ай бұрын
Amazing example sir !!
@sai5926
@sai5926 6 жыл бұрын
Excellent explanation about polymorphism Naveen garu
@delgole2868
@delgole2868 5 жыл бұрын
Thank you sir, i use your videos for my students and it really helps us alot
@mdrehan8266
@mdrehan8266 6 жыл бұрын
sir thanx a lot now I satisfied completely from polymorphism coz I always get stuck on this topic
@fareedahmedkhan9923
@fareedahmedkhan9923 3 жыл бұрын
Sir, what if we have got multiple methods with same name but different parameters in different classes Not in same classes Than what will be it called method Overloading or method overRiding
@chaitali2811
@chaitali2811 2 жыл бұрын
As per my knowledge, it will be called as method overloading because if we call the method from child class object, then it will return the result as per the parameters we are passing. It can return results from parent class too as per parameters passing.
@abdelmalek9004
@abdelmalek9004 4 жыл бұрын
thank you very much,this is amazing, good explaining, the example of phone was is very impressive thank you again.
@_KIRUBHASANM
@_KIRUBHASANM Жыл бұрын
Sir can we have two classes which has same named methods but without inheritance?
@vigneshm3114
@vigneshm3114 4 жыл бұрын
Thank you very much Mr. Telusco sir..🙏
@mohammedviso2269
@mohammedviso2269 8 жыл бұрын
yes finally I understand the polymorphism .....Thanks to you
@jegadeeshjega296
@jegadeeshjega296 2 жыл бұрын
Good and super and explained well with example
@arvind_purushotham
@arvind_purushotham 3 жыл бұрын
father example..easy to remember for polymorphism, method overriding
@alienpuppy
@alienpuppy 7 жыл бұрын
Actually polymorphism means many forms. Although i understand everthing in all of your videos, i still cant get the concept of polymorphism, and how are overriding and overloading related to it. thanks for your videos and greetings from south america.
@zombnie
@zombnie 5 жыл бұрын
very well explained.Thanks navin
@THEGAMER-cc2eq
@THEGAMER-cc2eq Жыл бұрын
"My father's phone is my phone but my phone is not my father's phone" Father: Mera raja beta, aaja idhar tuze chocolate deta hu, aaja
@bijoyaroy4559
@bijoyaroy4559 4 жыл бұрын
Overloading is static polymorphism, compile time and overriding is dynamic polymorphism, runtime
@ramgirirakesh7262
@ramgirirakesh7262 7 жыл бұрын
Good explanation with an example. Thank u sir..
@TheFlyguy31
@TheFlyguy31 8 жыл бұрын
Thank you very much, Mr Reddy
@aysha-8781
@aysha-8781 2 жыл бұрын
♥️ best lecture.
@raaoohin863
@raaoohin863 2 жыл бұрын
public class A { public void printthis(){ System.out.print("love the way you explain"); } public static void main(String args[]){ A obj=new A(); obj.printthis(); } }
@chrisnoble2071
@chrisnoble2071 4 жыл бұрын
Great explanation. Thank you
@sherothkar5809
@sherothkar5809 6 жыл бұрын
nice story and good example sir!tq
@wethebest7252
@wethebest7252 6 жыл бұрын
You are amazing sir i really really appreciate...
@TonyBlundetto86
@TonyBlundetto86 5 жыл бұрын
Telusko is SO BOSS. I made my example with Animal as a superclass of Cat. As an animal, a cat breathes, eats, and shit. As a cat, meows, claws, and purrs. Overloading.- As an animal, eats(fish) and eats(meat).- Same method name, different parameter in the same class animal. Overriding.- Every animal shits everywhere they can normaly shit(where){everywhere}. A cat just shits in a sandbox. shit(where){sandbox}.- Same method in different class (Animal and Cat), shit(where) in child class cat overrides the shit(where) superclass Animal method, so our cat will be nice and shit in a sandbox as it should.
@collinsushi1155
@collinsushi1155 7 жыл бұрын
To me, this video is centered on inheritance, method overloading and subclass overriding methods in superclass. You apparently said nothing on Polymorphism.
@SpiderpigThe
@SpiderpigThe 7 жыл бұрын
This is what Polymorphism is in Java, Method overloading is an example of static polymorphism, while method overriding is an example of dynamic polymorphism. The example he provided fits the best and the most important example in Java, which happens in parent to a child relation. Got finals tomorrow in Java lets see if he's right or not lol.
@collinsushi1155
@collinsushi1155 7 жыл бұрын
Whao!!! I apparently believe that; there is no polymorphism involved with overloaded methods (i.e methods with the same name but different arguments lists)
@siddharthadas86
@siddharthadas86 7 жыл бұрын
Absolutely. Polymorphism is with relation to method overriding. However when you override a method in a subclass, you can if the situation arises also overload it. The biggest advantage with polymorphisms is that behavior is defined in superclass but the nature of it depends on subclass type. So basically if two or more objects have the same instance variables but very different implementation of them in subclass, you put them inside an abstract superclass and then override those in your subclass as per your requirements. It saves lots and lots of extra coding. Abstract classes, polymorphisms/method overriding, Interfaces, inheritance and encapsulation is what OOP is all about
@eswarprasad9773
@eswarprasad9773 6 жыл бұрын
I agree with collins,coz in practical true polymorphism comes into picture when Upcasting and downcasting s done! yeah overloading and overriding are related to polymorphism,but he explained them with inheritance as center point viz a subclass using and changing its superclass s methods.
@nikeshprasad5559
@nikeshprasad5559 6 жыл бұрын
My question, When we call B.show(); and class B being a subClass does it also calls the default constructor of superClass before calling the show method of class B?
@joshinim.n9863
@joshinim.n9863 4 жыл бұрын
Yes , it does. But super class constructor here is default and empty. its internally called. public A(){ }
@swatidikonda955
@swatidikonda955 8 жыл бұрын
the lec was very nicely explained i want more lec on oops
@mohamadakkad4887
@mohamadakkad4887 7 жыл бұрын
deal with u
@naveen.pentela
@naveen.pentela 5 жыл бұрын
you explained very well sir
@dharanis9277
@dharanis9277 4 жыл бұрын
Nice explanation bro
@sonalinarkar6087
@sonalinarkar6087 9 ай бұрын
Hello sir , do you still have live sessions to for questions and answers?
@nikhileshm865
@nikhileshm865 4 жыл бұрын
Perfect exemplification
@vigneshwarvicky5048
@vigneshwarvicky5048 5 жыл бұрын
nice example for method overriding with real time scenario
@yashbudhe97
@yashbudhe97 2 жыл бұрын
6:32 Epic Example😂
@nehamaggu3719
@nehamaggu3719 6 жыл бұрын
sir you hv not defined scenario when parent object is used to call methods and incase parent is not having function and parent object is used to call child method
@sheriffcrandy
@sheriffcrandy 4 жыл бұрын
Thank you Professor!
@vicky89ist
@vicky89ist 7 жыл бұрын
great teaching skill
@Coolpratik10
@Coolpratik10 5 жыл бұрын
my phone is my phone none of your phone ,,, System.out.println("hello sir,nice lecture easy to understand ");
@vinuthbt6647
@vinuthbt6647 2 жыл бұрын
Thank you so much ❤❤❤
@6977202865
@6977202865 5 жыл бұрын
awesome explanation!!!!
@luckyentertainment186
@luckyentertainment186 5 жыл бұрын
U r simply awesome sir
@rajeshthakur-0163
@rajeshthakur-0163 4 жыл бұрын
when we call a sub class isn't it als0 call the default class of the extended class and print two output one from the sub class and other from the default class
@yuvakiran1284
@yuvakiran1284 2 жыл бұрын
Excellent 👌👌👌👌👌👌
@muhammadsaadamin6574
@muhammadsaadamin6574 7 жыл бұрын
sir you just have told overriding function but you havnt told which function will going to be run ie class A.show or classB.show kindly clearify in the reply below thnku v much !
@bogdanvasile5190
@bogdanvasile5190 8 жыл бұрын
Great trainer!
@alanoods8742
@alanoods8742 4 жыл бұрын
Thank you soo much 🙏🏻🙏🏻🙏🏻
@nikitanikam9807
@nikitanikam9807 Жыл бұрын
Thank you 😊
@ashutoshsharma5258
@ashutoshsharma5258 3 жыл бұрын
I was the one who was calling around 6:00. Sorry to disturb you all.
@ankitchandora6902
@ankitchandora6902 6 жыл бұрын
Very well explanation :)
@uttampal5078
@uttampal5078 5 жыл бұрын
Great concept
@laxminarayanpandey1191
@laxminarayanpandey1191 7 жыл бұрын
Well explained.
@rusty5100
@rusty5100 7 жыл бұрын
Great video. I laughed at your Hammer phone reference hahahahhahah
@vaibhavv.ranjan3392
@vaibhavv.ranjan3392 7 жыл бұрын
What is the difference between: A x = new A(); and A x = new B(); Considering that: class A class B extends A
@mahi277149
@mahi277149 7 жыл бұрын
A x = new A() is object of A class with reference variable x of Class A. A x = new B() is object of B class with reference variable x of Class A. see this example u can understand. class Parent { void m1(){System.out.println("Parent class m1 method");} } class Child extends Parent { void m1(){System.out.println("Child class m1 method");} void m2(){System.out.println("Child class m2 method");} public static void main(String[] args) { Parent p = new Child(); p.m1(); //there is m1 method in parent //p.m2(): // there is no m2 method in parent there is an error message. Child c = (Child)p; c.m2(); } }
@milaismyname
@milaismyname 6 жыл бұрын
I think you are wrong here, Parent cant be a new Child, because Child extends Parent, so Parent is the more generall class. That is why i think Parent p = new Child(); is false, it should be Child c = new Parent();
@arunjaiswal854
@arunjaiswal854 2 жыл бұрын
QnA sessions are going on?
@nikhiljadhav6621
@nikhiljadhav6621 7 жыл бұрын
Is there any concept of Object Overriding ?
@nirmalapatra5985
@nirmalapatra5985 6 жыл бұрын
i heard about compile time polymorphism and runtime polymorphism. what is it then?
@muthusamyr4310
@muthusamyr4310 5 жыл бұрын
Ur example was awesome
@Asingh42
@Asingh42 8 жыл бұрын
what is polymorphism I did not understand I just understand overriding and overloading
@laxminarayanpandey1191
@laxminarayanpandey1191 7 жыл бұрын
Polymorphism is the ability of an object to take on many forms. The most common use of polymorphism in OOP occurs when a parent class reference is used to refer to a child class object. if A is parent and B is child, then the reference of A should be able to refer the object of B: A ref=new B();
@sai5926
@sai5926 6 жыл бұрын
both overloading and overriding are called as polymorphism
@perkhaahmad1136
@perkhaahmad1136 7 жыл бұрын
yes of course ........Ahnis Aneja same question is mine?????
@nirajpratimbhuyan76
@nirajpratimbhuyan76 5 жыл бұрын
Please let us know about Dynamic Polymorphism.
@HarshvardhanMishraPIER8
@HarshvardhanMishraPIER8 2 жыл бұрын
Why method overiding is called runtime polymorphism?
@Nisheemishra
@Nisheemishra 5 жыл бұрын
Hi Sir, Once i was asked give one example of a program which can have both overloading and overriding concept? Could you please help me on this
@swethabasani9707
@swethabasani9707 4 жыл бұрын
What r the java concepts we have to learn for selenium?
@shivamkamdi6822
@shivamkamdi6822 2 жыл бұрын
Thanks sir .!!!
@michalmankus6028
@michalmankus6028 6 жыл бұрын
java god, keep up and many thx
@QuranicLens
@QuranicLens 4 жыл бұрын
Amazing sir
@mrsukki8158
@mrsukki8158 4 жыл бұрын
Ur just 30 now,❤️
@siddharthasonu845
@siddharthasonu845 6 жыл бұрын
if we create a object of class A in main class line A obj= new B; and then we call the object obj.show . what will happen? the parent class will display first and then child class right?
@nandiniadolf3660
@nandiniadolf3660 5 жыл бұрын
siddhartha sonu no,,,it actually calls inhertied class show method...because I've created an object of class B(A obj='''new B()''') the thing is left side of = is jst the reference which has negligible importance u dont have to worry about that...right side of equal to is what it matters actually I mean for which class the object is created...
@prakharsatyam6259
@prakharsatyam6259 7 жыл бұрын
sir can we have 2 classes in which the second extends the first but still there are some methods which can't be accessed by the second class
@SriniVasan-zc5ew
@SriniVasan-zc5ew 7 жыл бұрын
Prakhar Satyam java did not support multiple inheritance thats only jump to section interfaces
11.1 Object Cloning in Java Theory
4:47
Telusko
Рет қаралды 174 М.
Java Polymorphism Fully Explained In 7 Minutes
7:16
Coding with John
Рет қаралды 308 М.
The CUTEST flower girl on YouTube (2019-2024)
00:10
Hungry FAM
Рет қаралды 4,8 МЛН
Glow Stick Secret Pt.4 😱 #shorts
00:35
Mr DegrEE
Рет қаралды 11 МЛН
这三姐弟太会藏了!#小丑#天使#路飞#家庭#搞笑
00:24
家庭搞笑日记
Рет қаралды 101 МЛН
#42 This keyword in Java
9:45
Telusko
Рет қаралды 128 М.
Stream API in Java
26:04
Telusko
Рет қаралды 313 М.
🔥Polymorphism in detail with Example in Hindi
20:44
Learn Code With Durgesh
Рет қаралды 86 М.
14.11 HashMap and HashTable in Java
8:44
Telusko
Рет қаралды 677 М.
What is Dependency Injection? | Why | Spring
8:17
Telusko
Рет қаралды 697 М.
#22 Class and Object Practical in Java
15:36
Telusko
Рет қаралды 229 М.
METHOD OVERRIDING - JAVA PROGRAMMING
19:27
Sundeep Saradhi Kanthety
Рет қаралды 165 М.
Abstract Classes and Methods in Java Explained in 7 Minutes
7:00
Coding with John
Рет қаралды 505 М.
The CUTEST flower girl on YouTube (2019-2024)
00:10
Hungry FAM
Рет қаралды 4,8 МЛН