Java Polymorphism Fully Explained In 7 Minutes

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 เม.ย. 2021
  • Complete Java course: codingwithjohn.thinkific.com/...
    What does polymorphism mean in Java? So many classes and courses overcomplicate it, but polymorphism is really super simple. We'll talk about what polymorphism means in Java, and go over two different kinds.
    Polymorphism is one of the 4 core concepts of Object-oriented programming languages. And it's such a scary sounding word, but it refers to a simple concept.
    Learn or improve your Java by watching it being coded live!
    Hey, I'm John! I'm a Lead Java Software Engineer and I've been in the programming industry for more than a decade. I love sharing what I've learned over the years in a way that's understandable for all levels of Java developers.
    Let me know what else you'd like to see!
    Links to any stuff in this description are affiliate links, so if you buy a product through those links I may earn a small commission.
    📕 THE best book to learn Java, Effective Java by Joshua Bloch
    amzn.to/36AfdUu
    📕 One of my favorite programming books, Clean Code by Robert Martin
    amzn.to/3GTPVhf
    🎧 Or get the audio version of Clean Code for FREE here with an Audible free trial
    www.audibletrial.com/johnclean...
    🖥️Standing desk brand I use for recording (get a code for $30 off through this link!)
    bit.ly/3QPNGko
    📹Phone I use for recording:
    amzn.to/3HepYJu
    🎙️Microphone I use (classy, I know):
    amzn.to/3AYGdbz
    Donate with PayPal (Thank you so much!)
    www.paypal.com/donate/?hosted...
    ☕Complete Java course:
    codingwithjohn.thinkific.com/...
    codingwithjohn.com
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 431

  • @LitchBeats
    @LitchBeats 3 ปีที่แล้ว +518

    This guy is way too underrated 🔥

    • @electronoob7341
      @electronoob7341 2 ปีที่แล้ว

      Yes!

    • @MrSkinkarde
      @MrSkinkarde 2 ปีที่แล้ว

      Boring stuff

    • @SakkePie
      @SakkePie 2 ปีที่แล้ว +17

      @@MrSkinkarde why are you watching if you're not interested 😂

    • @sauravrajmitra6804
      @sauravrajmitra6804 2 ปีที่แล้ว +3

      He was born to teach Java

    • @turuus5215
      @turuus5215 ปีที่แล้ว +1

      @@MrSkinkarde You're Finnish, aren't you?

  • @electronoob7341
    @electronoob7341 2 ปีที่แล้ว +310

    My Univ. professor couldn't explain it to me like this over a whole semester!
    Now here I am understanding it in under 10min.
    Thank you!

    • @King-cv6mn
      @King-cv6mn 2 ปีที่แล้ว +1

      Perhaps you should have come here first

    • @michimarz
      @michimarz ปีที่แล้ว +5

      John has some very good videos, but this one is kinda disappointing, I'd say. It's not exactly polymorphism what John is explaining here. It's more like he's only describing inheritance. That said, I think you should have listened more carefully to your Professor instead.

    • @techatival
      @techatival ปีที่แล้ว +2

      "If you can't explain it simply, you don't understand it well enough." - Albert Einstein

    • @Veer34286
      @Veer34286 ปีที่แล้ว +2

      maybe bc you love dogs and cats

    • @justspacing9031
      @justspacing9031 10 หลายเดือนก่อน

      @@michimarz What? Did you even watch the video?

  • @amphousee
    @amphousee หลายเดือนก่อน +8

    2024 and this is still the best short explaination of polymorphism on TH-cam.

    • @piotrek7633
      @piotrek7633 หลายเดือนก่อน

      Maybe theyre wrong

  • @user-nc4ys3fc2x
    @user-nc4ys3fc2x 3 ปีที่แล้ว +55

    Very good videos. You explain things in ways that eliminates confusion and covers all bases.

  • @travismaurice6308
    @travismaurice6308 ปีที่แล้ว +70

    Dude. You really just saved my entire life. I was having so much trouble understanding how to explain polymorphism and putting it into my own words. You explained it so perfectly in so many ways. Great content!

    • @mmq6525
      @mmq6525 ปีที่แล้ว +3

      lol entire life? a little dramatic aren't we

    • @smeboo9044
      @smeboo9044 11 หลายเดือนก่อน +2

      @@mmq6525got somethin’ to prove now do we?

    • @EkThaKingMan
      @EkThaKingMan 8 หลายเดือนก่อน

      @@mmq6525 bros got gun to his head by boss as we watch

  • @feynthefallen
    @feynthefallen 3 หลายเดือนก่อน +3

    It's always nice to see you still got the basics down, even though I think I never EVER went and thought "I'm gonna use polymorphism on that sucker", but just went and did it.

  • @darylbaptie5159
    @darylbaptie5159 8 หลายเดือนก่อน +1

    Thanks John! After hours of trying to find a clear explainaton you wrapped it up in 7 minutes, thanks again!

  • @jimmysmith9462
    @jimmysmith9462 2 ปีที่แล้ว +1

    That was such a simple explanation that was being made WAY too complicated in my class. Thank you for putting this stuff out there.

  • @vanshika.singh.1
    @vanshika.singh.1 2 ปีที่แล้ว +1

    The fact that this was explained so perfectly and clear and it just clicked so well. Amazing job done!

  • @RJones-mx2oi
    @RJones-mx2oi 2 ปีที่แล้ว +1

    I really wish I had found you and your channel months ago. Even though you are speaking fast, I am grasping and retaining the concept to write into code.
    Thank you so much!!!

  • @ainsleys4402
    @ainsleys4402 ปีที่แล้ว +2

    I don't know how to express my gratitude dude, you've saved me. I've been struggling really hard with my Java class and you have a gift for explaining in a way that scratches my brain the right way.

  • @eetulaakso5374
    @eetulaakso5374 2 ปีที่แล้ว +2

    Thank you! I'm so happy that I found your video. I definetely watch other content from you, since you explain this topic so clearly. This makes so much more sense even in English compared the videos of my native language in which I just don't understand this subject at all.

  • @daniaaguila9824
    @daniaaguila9824 2 ปีที่แล้ว +3

    Hi John, thanks for your Java tutorials with non-monotone voice. If you can explain more about composition and aggregation in Java that would be great (your explanations are easier to digest compared to other youtube tutorials)!

  • @rizcmt195
    @rizcmt195 2 ปีที่แล้ว +1

    excellent spent 2 hours watching diff videos to understand the concept but you explained way better and way easy from all of them

  • @lisahlee5678
    @lisahlee5678 2 ปีที่แล้ว +23

    You have no idea how I struggled to understand this, about 5 hours before exam i stumbled upon this video, thank you. It was super easy to understand, never thought someone could explain polymorphism this way

  • @vaio007
    @vaio007 2 ปีที่แล้ว +1

    The best Java programming youtuber !! Wish I had known his channel back in 2021 beginning when I started the programming module in Uni.. Explains way better than many of my lecturers ! Thank You !!!

  • @maniac7591
    @maniac7591 ปีที่แล้ว +1

    Great explanation. I've been trying to study up for an interview (has been years since I graduated and been in a different field so I forgot everything). When I was studying it wasn't clear that method overriding and method overloading were part of Polymorphism. They made it seem like they were totally different things so thank you for clearing it up!

  • @cristhianjesus8978
    @cristhianjesus8978 5 หลายเดือนก่อน +1

    You are an amazing teacher, know that. I've been doing a lot of java courses and these topics are always convoluted and extremely difficult to understand, but you've managed to explain in a simple way. Thanks!

  • @Molotom
    @Molotom 2 ปีที่แล้ว +3

    Thanks for the video! You're helping a beginner coder in college out quite a bit :)

  • @NatanStarke
    @NatanStarke 2 ปีที่แล้ว +1

    Long time im out of programming life but seeing this video kinda make me happy remembering some stuff. Also very good explanations!

  • @lazarus8011
    @lazarus8011 ปีที่แล้ว +7

    Jonny Sins is the best at teaching programming

  • @fallennarcotic6981
    @fallennarcotic6981 ปีที่แล้ว +1

    You have not fully understood a problem if you can not explain it to someone else.
    This guy is an expert in his field making the explanation affordless

  • @mrtoast244
    @mrtoast244 2 ปีที่แล้ว +21

    John is so concise in his teaching, my lecturer literally takes two hours to cover the exact same concepts

    • @eternalflames911
      @eternalflames911 11 หลายเดือนก่อน +2

      memento mori

    • @mrtoast244
      @mrtoast244 11 หลายเดือนก่อน

      @@eternalflames911 🖤🤍

  • @roverojermainemariongilr.2856
    @roverojermainemariongilr.2856 3 ปีที่แล้ว +1

    O that's great and I'm learning more on your channel! Thank you for this!
    Love from the Philippines!

  • @xenophage5562
    @xenophage5562 ปีที่แล้ว +1

    This was a fantastic explanation that I was able to wrap my head around, bravo good sir!

  • @inspiresomeone8565
    @inspiresomeone8565 ปีที่แล้ว +13

    I always wonder why University teachers spend whole semester to explain the topic but you still don't understand, but here on you tube you watch 7 minutes video about the topic and fully understand what the heck it is all about .
    Thank you John very much for your great content!

    • @eric.m5790
      @eric.m5790 ปีที่แล้ว

      University teachers are not programmers. If you want to learn how to swim i think its best to learn from someone that already knows how to swim

    • @michimarz
      @michimarz ปีที่แล้ว +2

      John has some very good videos, but this one is kinda disappointing, I'd say. It's not exactly polymorphism what John is explaining here. It's more like he's only describing inheritance. That said, I think you should have listened more carefully to your Professor instead.

    • @JJJJ-gl2uf
      @JJJJ-gl2uf ปีที่แล้ว

      Surely your college teachers aren't spending an entire semester explaining one concept to you. Java [programming] doesn't come easily or quickly to everyone, maybe hit the books a bit harder or do what you're doing here: supplement your college lessons with YT videos.

  • @crawfishmedia
    @crawfishmedia 2 ปีที่แล้ว

    I'm in a Java course and wasn't understanding this topic. Now its perfectly clear. THANK YOU!

  • @ibrahimaminu4045
    @ibrahimaminu4045 2 ปีที่แล้ว

    Man how did i only find this channel now great content so easy to understand concepts the way you explained in this video!!

  • @howaboutsomesoyfood
    @howaboutsomesoyfood ปีที่แล้ว

    straight to the point way of explaining this concept, most others just over-complicate it and are needlessly verbose.

  • @menaaziz27
    @menaaziz27 2 ปีที่แล้ว +67

    Subscribed!
    with polymorphism also you can always assign a subclass object type to a super class reference type
    like that
    Animal cat = new Cat();
    Animal dog = new Dog();
    Animal a = new Animal();
    Since
    Animal cat = new Cat()
    | |
    | |
    Reference type object type
    Happy coding everyone.

    • @MrSelmanceltiker
      @MrSelmanceltiker 2 ปีที่แล้ว +32

      Actually this is the correct explanation of polymorphism. The video content explains inheritence mechanics of OOP. Inherıtance provides child class type object act like parent class type object by inheritence. Polimorphism provides parent class type object can act like chıid class type object. Internal mechanics are very different.

    • @elizaalwani9200
      @elizaalwani9200 2 ปีที่แล้ว

      So does the reference type or object type determine which method is used

    • @KaraSuraDraw1
      @KaraSuraDraw1 2 ปีที่แล้ว

      @@elizaalwani9200 The object type

    • @brutusjackendy3658
      @brutusjackendy3658 2 ปีที่แล้ว

      @@elizaalwani9200 The object type does.

    • @nolan_villeneuve
      @nolan_villeneuve 2 ปีที่แล้ว +3

      @@elizaalwani9200 the object type does. BUT the availability of methods is determined by the reference type.

  • @FukSN
    @FukSN 2 ปีที่แล้ว +1

    Very clear and easy to follow.
    Thanks John ✌

  • @devangprabhune3591
    @devangprabhune3591 ปีที่แล้ว +1

    You're way of explaining is playful and very expressive. ❤️ it

  • @thezopelo
    @thezopelo 7 หลายเดือนก่อน

    Thank you for the clarification on overloading vs overriding.

  • @TheRebelMerchant
    @TheRebelMerchant 2 ปีที่แล้ว

    excellent video. I am a CIS student this is now starting to all make sense.

  • @ChrisLevi22
    @ChrisLevi22 ปีที่แล้ว

    this guy explained a concept in 7 minutes so much better than my professor could in 2 hours. Unreal man. Such a lifesaver

  • @tanyashankar1664
    @tanyashankar1664 2 ปีที่แล้ว

    Hi,John...you made my life so easy..was struggling to understand the polymorphism concept until i found your video...much love from india

  • @emilyoldson8213
    @emilyoldson8213 2 ปีที่แล้ว

    Just found you today and am so thankful I did! Thank you!!

  • @stopfbums
    @stopfbums ปีที่แล้ว

    Wow this is just amazing.
    Currently studying computer science and you help me so much!

  • @TheTamaraTami
    @TheTamaraTami 2 ปีที่แล้ว

    Very well explained! Thank you John for sharing this

  • @theNorth473
    @theNorth473 3 ปีที่แล้ว +2

    Unbelievably clear. Thank you!

  • @ironbirdstudios
    @ironbirdstudios 7 หลายเดือนก่อน +2

    i usually never comment on videos, but this guy deserves it all. help me finally end my struggle with CSE 205.

  • @protocolcode2703
    @protocolcode2703 2 ปีที่แล้ว

    Thank you so much. I was looking at a video at linkedin learning an I was about to quit learning java due to that video. You made it so simple and easy. Thank you from the bottom of heart.

  • @nunya1120
    @nunya1120 3 ปีที่แล้ว

    Your channel is still very new, but wow, if you keep this up you're going to grow exponentially. Love your content please keep it up.

  • @heartoutloud7498
    @heartoutloud7498 2 ปีที่แล้ว

    Ur explanations are as clean as ur code John. Thank you

  • @prathapkoththigoda9471
    @prathapkoththigoda9471 3 ปีที่แล้ว +4

    It was a nightmare to find a video to understand Polymorphism. Thanks a lot.

  • @MyLe-wc5dg
    @MyLe-wc5dg 2 ปีที่แล้ว +1

    Heyy thank you for this video. Your pronunciation as well as explanation are really easy to understand for a Vietnamese student like me. Keep uploading more informative video please 🙏 Have a nice day ☺️☺️

  • @Alibeee87
    @Alibeee87 2 ปีที่แล้ว

    Thank you for helping me get through my first year as a graduate student!

  • @bioblade87
    @bioblade87 2 ปีที่แล้ว

    awesome video. The code examples really help too!
    I use method overloads all the time in c# systems class but didn't know it's a result from polymorphism. Thanks

  • @stevewilliams4939
    @stevewilliams4939 2 ปีที่แล้ว

    Thank you for making these videos. You are a great teacher and communicator. Kind regards. 🙂

  • @sigfigronath
    @sigfigronath 2 ปีที่แล้ว

    Thank you, please do for the other 3 java core concepts as well!

  • @linkedprosperity
    @linkedprosperity 2 ปีที่แล้ว

    So fun with John...geez I have to get his training...makes Java fun.

  • @zero_n_one3782
    @zero_n_one3782 2 ปีที่แล้ว +1

    Thank you for the videos. I have humble request for you to make a clear and understandable videos regarding polymorphism via inheritance and polymorphism via interface and passing an object as argument. Thank you once again for good video.

  • @textinface1
    @textinface1 ปีที่แล้ว

    Amazing explanation. I'm sure you already know but your teaching skills are helping thousands of students including myself. Thank you so much!

  • @jaafarshili7869
    @jaafarshili7869 6 หลายเดือนก่อน

    Thank you for the content and for being humble, keep it up :' ) Much Love.

  • @kathrinm2420
    @kathrinm2420 6 หลายเดือนก่อน

    You really are a great explainer, thank you! I also didn't get the concetp at uni

  • @WattsnabbAB
    @WattsnabbAB ปีที่แล้ว

    Thanks!! you doing a great job explaining this!! Really appreciate!!

  • @Raccoon_In_A_Suit
    @Raccoon_In_A_Suit 2 หลายเดือนก่อน

    Words fall short to convey how helpful this lecture was sir.Thank you ❤❤

  • @firasjab
    @firasjab 2 ปีที่แล้ว +4

    I think what you have described here is simply inheritance & method overloading. Polymorphism is a bit more advanced than that. You could for example have declared the cat and dog objects as Animal. That would at least have introduced the concept of polymorphism.

  • @tonymaina7592
    @tonymaina7592 2 ปีที่แล้ว

    Finally found a video and understood it. Thanks man

  • @Curiousgoogler
    @Curiousgoogler 3 หลายเดือนก่อน

    Thank you sir for making this concept easy to understand.

  • @berthelmantel5043
    @berthelmantel5043 2 ปีที่แล้ว

    Simple and clear explanation, thanks John!

  • @agreizda4323
    @agreizda4323 หลายเดือนก่อน

    I am currently studying for my finals exam in Germany and this is just perfectly explained. THANKS!

  • @bemeb41yashsakpal90
    @bemeb41yashsakpal90 ปีที่แล้ว

    This guy knows the art of teaching, he explained all the concepts in such a smooth way, he makes learning fun & interesting 😇👍

  • @juicifer2024
    @juicifer2024 2 ปีที่แล้ว

    Explaining what my comp sci professors couldn't explain during lectures...I do realize you have the benefit of hindsight and editing to make videos go a lot smoother than lectures, and there absolutely is value to lectures since we can actively ask questions and receive answers...But the way you structure your videos has been all but confusing thus far. Love this page.

  • @7002K
    @7002K 2 ปีที่แล้ว

    Awesome now I will never forget about method overriding and overloading

  • @TheRealFenwick
    @TheRealFenwick 2 ปีที่แล้ว +4

    Thank you so much John! you have helped me so much with my internship! Shout-out from Australia

  • @littlecatboybuddy
    @littlecatboybuddy 2 ปีที่แล้ว

    this was very helpful! Thank you so much, John😀

  • @alanfang7665
    @alanfang7665 5 หลายเดือนก่อน

    Thank you for explaining the topic so well..... I found your material way easier to digest than my java class! Doing God's work out there.

  • @pravir_raghu
    @pravir_raghu 2 ปีที่แล้ว

    Clear and to the point, great video

  • @Mobin92
    @Mobin92 2 ปีที่แล้ว +3

    You kinda left out the main point of Polymorphism. The conclusion should be that you can store all the different instances (e.g. of Dog, Cat, ...) in Animal variables and it still does the proper thing! Usually you e.g. have a List which contains different animals, and you can just call the eat() function on each element without worrying what type it actually is.

  • @tadele3947
    @tadele3947 ปีที่แล้ว

    Very fast and excellent lecture!he suits me!

  • @habtamusium8646
    @habtamusium8646 ปีที่แล้ว

    I got override just at this time . many thanks !

  • @arno5405
    @arno5405 2 ปีที่แล้ว +3

    Well done my guy. Great video

  • @increment-
    @increment- 4 หลายเดือนก่อน

    2-3 uni lectures in 7 minutes, ur amazing!

  • @jenniferr2033
    @jenniferr2033 2 ปีที่แล้ว

    Explaining things better than youtubers with 500k+ Subscribers ...John you are doing gods work thank you so much

  • @NYUCODERS
    @NYUCODERS 2 หลายเดือนก่อน +1

    He made it Simple. Thank you 😊

  • @kibuulekalembe4726
    @kibuulekalembe4726 2 ปีที่แล้ว

    very helpful. Understood polymorphism and encapsulation in less than 30 minutes.

  • @MYTHIICOOL
    @MYTHIICOOL 3 หลายเดือนก่อน

    John you might be one of the best tutors on TH-cam🙏🏼

  • @ar08456
    @ar08456 8 วันที่ผ่านมา

    this helped me so much!!! thank you

  • @stvnk1m
    @stvnk1m 2 ปีที่แล้ว

    Very helpful! Thanks for sharing!

  • @verisad3472
    @verisad3472 2 ปีที่แล้ว

    You're really good at explaining/teaching! If I pass my midterm, I'll owe my grades to you lol

  • @lootster
    @lootster 28 วันที่ผ่านมา

    I don't understand why nobody can explain Polymorphism in such a simple yet elegant way!

  • @loganwillans4035
    @loganwillans4035 2 ปีที่แล้ว

    Great job! Very clear explanation.

  • @RefaatIbrahimXIT
    @RefaatIbrahimXIT หลายเดือนก่อน +1

    Polymorphism is overrider & overload Parent methods.
    Thank you John

  • @user-ot2nv4on1p
    @user-ot2nv4on1p 6 หลายเดือนก่อน

    WOW no words would express how useful your videos are 🙏

  • @youvegotmail9385
    @youvegotmail9385 ปีที่แล้ว

    My dude is awesome. Would be awesome to work under someone with his knowledge...and humor.

  • @diodesu
    @diodesu 2 ปีที่แล้ว

    Binge watching this man's videos. He's something else!

  • @sapir12351
    @sapir12351 2 ปีที่แล้ว

    Hey really great video, u make it look easy.. thx!

  • @carina.zip2002
    @carina.zip2002 2 ปีที่แล้ว

    My comp sci final is in two days and you are the only reason I'm not crying right now.

  • @Chrissownu
    @Chrissownu 4 หลายเดือนก่อน

    BRO THANK YOU SO SO MUCH U CHANNEL IS SAVING MY LIFE RIGHT NOW

  • @rafaeltschurtschenthaler5986
    @rafaeltschurtschenthaler5986 2 ปีที่แล้ว

    Man you are a savior! Now i finally understand it!

  • @ibrahimghasia1909
    @ibrahimghasia1909 ปีที่แล้ว

    Realy great explanation with a simple example!

  • @ilikniram1
    @ilikniram1 ปีที่แล้ว

    One of the best!
    thank you brother John :)

  • @ykzzy4876
    @ykzzy4876 2 ปีที่แล้ว

    God bless any TH-camr including you John who teaches coding.

  • @Htman
    @Htman 7 หลายเดือนก่อน

    Yoo John you are incredibly brilliant at teaching Java.

  • @lucifersenpai1948
    @lucifersenpai1948 ปีที่แล้ว

    Watching this video i exclaimed three times "Wow! this guy is great". Subscribed.

  • @okwuchukwuokwara1522
    @okwuchukwuokwara1522 หลายเดือนก่อน

    Hi John, you are such an awesome teacher.

  • @neslinkaragoz
    @neslinkaragoz 2 ปีที่แล้ว

    this was great! Thank you!

  • @lit_lay
    @lit_lay ปีที่แล้ว

    I was really confused
    but after watching this, I realized that I have done this in my program already but I don't know it's polymorphism .. thanks

  • @novanoskillz4151
    @novanoskillz4151 2 ปีที่แล้ว

    wow, i have asked and "re-asked" my professor to explain this to me. and i just wasnt getting it. ive learned more in the first 3 minutes of your video then what my prof. has been trying to explain to me in 4 weeks. Thanks so much.