Java Programming Tutorial - 49 - Inheritance

Поділитися
Вставка
  • Опубліковано 20 жов 2024
  • Source Code: github.com/the...
    Core Deployment Guide (AWS): docs.google.co...

КОМЕНТАРІ • 727

  • @itsbeiko
    @itsbeiko 10 років тому +716

    i don't know why i pay for my education if free youtube videos explain it x10 better

    • @mangoac
      @mangoac 10 років тому +33

      * I don't know why I pay for my education when free UA-cam videos explain things 10x better.

    • @MashrufKabir
      @MashrufKabir 10 років тому +1

      mang oac lol

    • @MashrufKabir
      @MashrufKabir 10 років тому

      Oh god yeah.. what're the odds hahahah What about you

    • @MashrufKabir
      @MashrufKabir 10 років тому +1

      Bruh, you're not alone lol...
      You on facebook? Add me up.

    • @masonalt5012
      @masonalt5012 10 років тому +5

      mang oac Good game bro, to bad good grammar didn't get anyone anywhere in programming.

  • @noshowcomedy3400
    @noshowcomedy3400 8 років тому +370

    this 10 mins video override the 2 - 1 hour and 20 mins session from my CS1351 class

    • @random-0
      @random-0 7 років тому +1

      lol yea

    • @pkgamma
      @pkgamma 7 років тому +2

      ay also watching this as a CS student! Taking CS125 at UIUC here HAHA

    • @ItsRawrTopia
      @ItsRawrTopia 6 років тому +1

      if(video > 9 mins && video < 10 mins)
      {
      System.out.println("what ever NO SHOW Comedy said");
      }
      else...

    • @ATGProntoTV
      @ATGProntoTV 6 років тому

      You miss @Override

    • @MuhammadBilal-th2yv
      @MuhammadBilal-th2yv 5 років тому +2

      u are right 45 minute lecture in my college were overrode by this 10 minute video

  • @socstrike7
    @socstrike7 9 років тому +174

    "make sure you spell some things wrong" hahaha I love this guy

  • @SpringfieldMa
    @SpringfieldMa 10 років тому +39

    Its 2014 and this still the best layman terms lectures hands down!

  • @MrEmperor96
    @MrEmperor96 10 років тому +36

    I swear my computer science prof can't teach anything, all I have learnt is from you.
    He marks really easy though :D

  • @ceriwestcott8784
    @ceriwestcott8784 9 років тому +218

    we spent 4 hours, I kid you not.. 4 hours on inheritance.

    • @MashrufKabir
      @MashrufKabir 9 років тому

      lol hahahaha

    • @rogernkosi8420
      @rogernkosi8420 8 років тому +8

      +Ceri Westcott inheritance, polymorphosm

    • @azertyazerty2072
      @azertyazerty2072 5 років тому +3

      We spent 3hours on how to run on cmd line (2nd video) so yeeah D:

    • @That_One_Guy...
      @That_One_Guy... 4 роки тому +3

      @Misan tropo exactly what deepness ? You just learn Inheritance in this video, you just need to know that Extends is the keyword used for Inheritance (that means allowing subclasses (children) to access superclasses (parents) behavior). I don't think that need to take 3-4 hours to explain.

    • @howellpendragon2227
      @howellpendragon2227 3 роки тому

      Our deadline for this one is till 15... but its hard for me cause we’re only given printed module with limited examples

  • @loganirons8949
    @loganirons8949 11 років тому +76

    "Anytime you want to inherit crap from another class..." Lol

  • @taevy12
    @taevy12 4 роки тому +4

    I watched my professor's video for an hour and learned nothing. You sir explain everything perfectly clear in 6 mins.

  • @RaulVargasTeacher
    @RaulVargasTeacher 6 років тому

    AP Computer Science Teacher here. Thanks for these videos. I share these with my students and they come in handy!

  • @shoheltube
    @shoheltube 13 років тому

    Many of my friends who know about extends tried to explain me about its functionality but I was not clear. Your 9.25 minutes make me so clear I hope I will not forget it. Thanks a lot. I will be always with your tutorial. I recommend all beginners to professionals your tutorial to make easy concept. Thanks again and hope you will keep going on.

  • @nuriya9000
    @nuriya9000 6 років тому

    My lecturer took 4 hours to explain this... You are a life savior

  • @wingold6006
    @wingold6006 8 років тому +69

    bucky boy i love your tutorials but they make me so hungry.

    • @Celestial21
      @Celestial21 7 років тому +2

      win Gold tuna Apple chicken lol

  • @AlchemicSound
    @AlchemicSound 7 років тому

    Just saved me 30 pages of reading and explained a 3 hour lecture in less than 10 minutes. Your vidoes (remembered to spell something wrong) are awesome! I am watching all your tutorials and they are all phenomenally helpful!

  • @trattanajariya1
    @trattanajariya1 7 років тому +4

    well this is a lot easier and faster than sitting through class lecture. A+

  • @MrEdwardSP
    @MrEdwardSP 8 років тому +7

    u make Inheritance much more easy to understand !! thank you

  • @kuchikishou1o
    @kuchikishou1o 7 років тому

    Me and mornings don't get along, especially on a Monday morning for OOP class. This is the simplified the version of the lecture that I had just 5 days ago. Thanks man this really help me since whenever I ask my instructor, I'd be given a really complicated answer.

  • @AsianOreoYo
    @AsianOreoYo 6 років тому

    the quick 10 minute vid formats are really good and make it easy to digest. well done

  • @psykodiak5333
    @psykodiak5333 5 років тому

    10 years later and these videos are still solid.

  • @oscarchivas3123
    @oscarchivas3123 10 років тому +81

    Adding to this, constructors are never inherited.

    • @dalalalghomlas1600
      @dalalalghomlas1600 9 років тому +2

      good one!

    • @RaqibZaman
      @RaqibZaman 5 років тому

      @John Rhaenys Could you give an example in code how "super ()" allows for inheritance?

    • @asyrafsufi4108
      @asyrafsufi4108 5 років тому +2

      @@RaqibZaman you mean inheriting the superclass constructor right?
      public SubClassName() {
      super();
      }
      just do it like that, correct me if i'm wrong im also new to java

    • @briandacallos4234
      @briandacallos4234 5 років тому

      @@asyrafsufi4108 but i can enherit the constructor for my super class ?

    • @hayden3774
      @hayden3774 4 роки тому +14

      @@briandacallos4234 The purpose of a constructor is to easily make objects. If you made a super class called Bird and it had instance variables:
      String color;
      int wingspan;
      Then you made the constructor :
      public Bird(String color, int wingspan) {
      this.color = color;
      this.wingspan = wingspan;
      }
      THEN you made a subclass Pigeon extends Bird and you wanted a constructor exactly like your Bird super class, but maybe you wanted to add a diet variable:
      String diet;
      You make the sub class (Pigeon) constructor take on the same values as your super class by adding super() in the new constructor:
      public Pigeon(String color, int wingspan, String diet) {
      super(color, wingspan);
      this.diet = diet;
      }
      You can then make your objects as such:
      If you want just a Bird ---------------> Bird b1 = new Bird("white", 10);
      If you want a Pigeon -----------------> Pigeon p1 = new Pigeon("gray", 11, "bread crumbs");
      You can't inherit the constructor from your super class, but you can incorporate the variables found in that super class into a new constructor with super()

  • @antoboy99
    @antoboy99 13 років тому +1

    im doing eclipse and have a test and you are helping me get ready for the test and explaining things better than my actual uni lecturers thank you so much!!!

  • @CRA1546
    @CRA1546 3 роки тому +1

    typical 10 minute video does better than my 2 hour lecture. cheers.

  • @yassershubber6193
    @yassershubber6193 4 роки тому

    it's easy when you implement simple methods and call them, however when dealing with super and sub constructors, there when all the confusion begins, but you explain it way a lot better than set of 1000p books

  • @Distrubutable
    @Distrubutable 11 років тому +7

    If your having trouble remembering everything but you understand the concepts then take your time to play around. If you rush through the tuts then you won't have time to remember anything. I take a intro to CS class and we do things VERY slowly. But we get a lot of problems and having to work through javax.swing can be challenging at times but you learn by solving problems.
    Test yourself. Maybe, while going through buckys tuts, develop a basic program but build upon every time you learn something(like a calculator or something :) )

    • @triparadox.c
      @triparadox.c 6 років тому

      Sometimes I feel like I am not capable though.. I don't know whether it is because this is my first time learning this, and I will only just enroll to the college. Sometimes I think I can't make any program..

  • @xxlifewirexx
    @xxlifewirexx 14 років тому

    your 9.24min kicks 2 hrs of lectures! thanks a million!

  • @cbox
    @cbox 14 років тому

    Bucky, you are so awesome that even my professor uses your videos in class. Thanks for helping students like me who are stuck with ineffective teachers

  • @yadavshashankkumar
    @yadavshashankkumar 6 років тому

    9 fuckin years and his course still holds a great value..... awesome lecture

  • @Babelfish112
    @Babelfish112 12 років тому

    Bucky is a complete expert on explaining things well. My lecturer could never do this. We love you Bucky!

  • @kareng4120
    @kareng4120 3 роки тому

    Bucky should get an award for being the best programming instructor on planet earth

  • @uthrasowrirajan7457
    @uthrasowrirajan7457 10 років тому +2

    You are the best teacher..Thanks a lot.. concepts explained so beautifully..

  • @01maku43
    @01maku43 4 роки тому +1

    2 days of lecture explained in 10 mins...
    SALUTE!

  • @13ahaa
    @13ahaa 10 років тому +7

    One left for the GUI! Let the party begin...

  • @nilemarbarcelos8643
    @nilemarbarcelos8643 12 років тому

    Guys, instead of using the "private" modifier, you can use the "protected" keyword, so classes from the same package as the superclass and the subclasses of it can access the method "eat"
    try it:
    protected void eat(){...
    Great work with this tutorials, Bucky, thank you from Brazil.

  • @paulinasieminska1656
    @paulinasieminska1656 4 роки тому

    Oh Maaan, Thank you so much, for helping me to understand this very complex Java World

  • @lilmanbeingerased
    @lilmanbeingerased 11 років тому

    Bucky is the best.
    You have no idea how helpful these tutorials are, thanks a bunch man!

  • @abdulazizsa2560
    @abdulazizsa2560 7 років тому

    I don't know what I would with java class without you after God of course
    Thank you ❤️🙏

  • @predatorBr
    @predatorBr 7 років тому

    Hey bucky been watching your videos for a long time now. Guys If your watching this I'm majoring in CS and currently in a role that requires great knowledge of programming. When I need to I always come looking for his tuts. Thanks!

  • @monicaceja6889
    @monicaceja6889 6 років тому

    I am so beyond grateful for these videos you make it so easy to understand

  • @rajivghundoo5904
    @rajivghundoo5904 7 років тому

    Great job! You make hard concepts really easy to understand for all levels of programmers!

  • @mightymechb2789
    @mightymechb2789 8 років тому +8

    8:53 "whenever u wabt to inherit CRAP from another class"----bucky
    looool

  • @jazzninja77
    @jazzninja77 14 років тому

    Bucky you are a genius!! This tutorial has cleared up sooo many java mysteries. Brilliant!

  • @kristofbe1
    @kristofbe1 12 років тому

    I have never seen tuna, apples and potpie go so well together

  • @RalphNgOfficial
    @RalphNgOfficial 10 років тому +2

    I'm doing my part time Degree in IT, the tutors are sucks, but you are my saviour!
    TQ Bucky

    • @gallegom58
      @gallegom58 10 років тому +9

      lol youtube > higher education :o

    • @moreno6283
      @moreno6283 10 років тому

      Michael Gallego same thing in EPFL Switzerland.. GO youtube GO

  • @zSatherz
    @zSatherz 9 років тому +2

    How could you possibly give such a helpful, easy to understand video a thumbs down?

    • @Celestial21
      @Celestial21 7 років тому

      zSatherz people were holding their devices upside down, and they thought they pressed the like button

  • @Robostate
    @Robostate 9 років тому +3

    And you can overLOAD methods in the superclass! Put this as a parameter in the food class method:
    public void eat(int x){
    and then call
    tunaObject();
    tunaObject(1);
    and the second one calls the food method instead. Java is pretty nifty!

  • @rogerpangda1612
    @rogerpangda1612 6 років тому +1

    Yo Man!!! T_T your tutorials really helped me in my prog. project .Even though this tutorial seems old but its GOLDEN.

  • @davidmax1816
    @davidmax1816 7 років тому +2

    If you want to teach in UA-cam You should born as a teacher like this guy!

  • @rinxalee8885
    @rinxalee8885 3 роки тому

    Now this is a simple yet effective tutorial

  • @contexto-doc
    @contexto-doc 10 років тому +36

    "Make sure you spell a couple things wrong there"

  • @CesarDMarin
    @CesarDMarin 6 років тому

    Yo man! this is amazing and so are all of your videos for the Java basics, it really made me understand all the nonsense from school! ... you sir are a legend and I have no words to thank you!

  • @nerdkidleo
    @nerdkidleo 12 років тому

    hey bucky! i wanna thank you for helping me out in my college studies man..i am the second year and i suck at java but after watching your tutorials...man i feel good! for now...

  • @johnboy14
    @johnboy14 15 років тому

    books make this sound so much more complicated than it really is, thanks man.

  • @xswooshx
    @xswooshx 7 років тому

    Thanks for the video! I agree with a couple of these posters about formal education trying to overexplain things. I'm in a grad course for beginning OOP using Java and a lot of the textbook chapters, videos ,etc., just seem excessive. I get that they're probably trying to give a full, technical overview of each subject, but I'm usually left with more questions than answers.
    I'm subscribing and will probably check out a LOT more of your videos. Cheers!

  • @freshly.refrigerated
    @freshly.refrigerated 11 років тому

    ok, you can extends or also known as inheritance almost anything. You can extends variables as well. Private can be access within the class and protected can be access within the class and all subclasses. That's why we have Protected, private and public :)
    Hope this helps others. :)

  • @relentless2917
    @relentless2917 7 років тому

    "Every single different clath" love it Bucky!

  • @iliach4680
    @iliach4680 4 роки тому

    LEGEND explained in simplest words

  • @martindesantiago5262
    @martindesantiago5262 9 років тому

    you are great in explaining this. and everything else. I look at your tutorial to help me study for my final and exams. thank you.

  • @13thChip
    @13thChip 14 років тому

    Hats off Coach ! You are better than our Corporate Traininer with 25 years Experience.

  • @1kingrule
    @1kingrule 14 років тому

    I learn more from you than i do in the $1500 Java class I'm currently taking!!!

  • @GraveRobbertt
    @GraveRobbertt 4 роки тому

    He's back. 2020 is no longer bad.

  • @OjeyonO
    @OjeyonO 12 років тому

    bucky - you have a real knack for explaining things - too bad my java teacher couldn't explain it this well

  • @codemage123
    @codemage123 5 років тому +1

    wow thanks soooo mutch this video helped me so mutch i could have just watched this insted of HOURS of classes

  • @Nvbeatz
    @Nvbeatz 14 років тому

    Great tutorial! Amazing clarity with detail and simplicity - ALL IN ONE little package! Thanks and keep it up!

  • @Chandler890
    @Chandler890 7 років тому

    Thank you brother for zooming in, knowing brothers watching on phones

  • @sporreking
    @sporreking 13 років тому

    I was waching a guy who had made a playlist for all buckys awesome vidz and he missed this tutorial!(it has to be the reason that the next tutorial is AWESOME!)!

  • @dazuza95
    @dazuza95 10 років тому +2

    Your tutorials always make me hungry :D

  • @poongkuzhali
    @poongkuzhali 14 років тому

    Excellent tutorial. I have watched many java tutorials, but this is the best. Thanks a lot guys for this clear tutorial. I have watched all Ur 87 tutorials, thanks a lot..Keep it up guys

  • @jwiel86
    @jwiel86 11 років тому

    Thank you for your videos! I don't know what I'd do without them!

  • @roli340
    @roli340 8 років тому +72

    I am the only one who thinks that his voice is similar to Walter Jr's voice from Breaking Bad?

    • @anishvyas9872
      @anishvyas9872 8 років тому

      Hahaha

    • @juansierra9946
      @juansierra9946 8 років тому +2

      Kid, you just changed my life.

    • @anurgaprasad123
      @anurgaprasad123 8 років тому +2

      sounds more like jesse pinkman when he makes his jokes

    • @krizvnenvy9125
      @krizvnenvy9125 8 років тому +14

      he may'have inherited the voice from walter Jr.

    • @Capn-Coin
      @Capn-Coin 8 років тому +1

      I see what you did there! wow... why did I find this so funny...

  • @MrYouMath
    @MrYouMath 12 років тому +1

    Wow that was buckylicous:D. You really did a great job on explaining inheritance;-). Thank you alot Bucky! And now lets get to video 50 ^^.

  • @thatgirlwiththatbook2191
    @thatgirlwiththatbook2191 7 років тому

    You are a life saver. You're making it sound soooo easy.

  • @ignacevansande
    @ignacevansande 5 років тому

    iv been a year in class and not understanding, finally I get it thank you!

  • @and_rayus
    @and_rayus 3 роки тому +6

    "this is the easiest thing in the world"
    my prof: Spends 2 lectures on inheritance

  • @jameses2007
    @jameses2007 14 років тому

    this is one of the best java videos i have seen thank you and if you wouldnt mind telling me are you using Eclipse?

  • @phendformyself
    @phendformyself 8 років тому

    Thank you so much! Your video helped me immensely! It's clear, concise, and easy to follow

  • @GospodinStanoje
    @GospodinStanoje 9 років тому +2

    Bucky you are the BEST! Thank you so much for everything :)

  • @KKorn429
    @KKorn429 12 років тому

    Great video. I am going to get an A in my java programming classes because you teach it so well. Good luck in your endeavors.

  • @katerokay6335
    @katerokay6335 7 років тому

    a very simple n easy to understand tutorial. Apart from that I love the way u say "Potpie"..:)

  • @ahmermirza
    @ahmermirza 7 років тому +2

    Thank you so much... seriously i don't know how to thank you!!! God bless you

  • @nicholasbraud1986
    @nicholasbraud1986 8 років тому

    I love how you don't correct typos haha. Makes me feel better about my dyslexic brain constantly spelled length like this...lenght. I cannot tell you how many times I have done this.

    • @vyuutuube
      @vyuutuube 8 років тому

      +nicholasbraud1986 what is the lenght of the times you spelled it wrong? :) ;)

  • @lukeagex
    @lukeagex 8 років тому

    That bloody extends keyword, now I finally understand!

  • @HugoIetsGaming
    @HugoIetsGaming 9 років тому +39

    I understand inheritance but when making bigger projects, I don't :/

    • @rogernkosi8420
      @rogernkosi8420 8 років тому +7

      +TeleTubbie Luver Practice Practice Practice Practice

    • @HugoIetsGaming
      @HugoIetsGaming 8 років тому +7

      Roger Nkosi I now understand yay :D

    • @rogernkosi8420
      @rogernkosi8420 8 років тому

      +TeleTubbie Luver Practice helped a lot I guess.

    • @HugoIetsGaming
      @HugoIetsGaming 8 років тому +1

      Roger Nkosi indeed

    • @rogernkosi8420
      @rogernkosi8420 8 років тому +2

      It can be a mind f**k especially Polymorphism

  • @hanasuru
    @hanasuru 13 років тому

    That was totally clear! There was nothing confusing about this at all! Thanks!

  • @rodyabd5355
    @rodyabd5355 7 років тому

    my teacher took 4 h to teach us this ! and here in just like 10 m and very simple! u should be a Professor rly

  • @cm_channelyt
    @cm_channelyt 12 років тому

    I had almost given up on programming until I came across these tutorials. Bucky for president?

  • @fildapil
    @fildapil 13 років тому

    @whitebenji Yea your right. Protected is visible to extended classes. Also a note. You can make private fields and have a public "getter" method to get each field. e.g. private int x; public int getX(){ return x;}. This means it will be available for all classes.

  • @nitinkamath3161
    @nitinkamath3161 6 років тому

    Note this:
    A subclass inherits all the members (fields, methods, and nested classes) from its superclass. Constructors are not members, so they are not inherited by subclasses, but the constructor of the superclass can be invoked from the subclass.

  • @derek8482
    @derek8482 5 років тому

    this is perfect...
    now i simply get it LIKE MAGIC

  • @ExploreWithFox
    @ExploreWithFox 12 років тому

    variables or methods with protected access modifiers can be accessed in subclasses, but not private methods.

  • @swamks69
    @swamks69 11 років тому

    wow best tutorial so far from Greg...cleared everything up!

  • @mayhem9200
    @mayhem9200 14 років тому

    Awesome tutorials....thanks a lot! What development environment are yous using?

  • @weaver2609
    @weaver2609 5 років тому +1

    bruh i swear this man is a god

  • @阿明-c2l
    @阿明-c2l 6 років тому

    learnt more from UA-cam than college, and youtube does not charge me 10 grands a year.

  • @emirje3844
    @emirje3844 8 років тому

    thanks a lot it help me understands better for my revision before final exam .

  • @AlexanderMccarthey87
    @AlexanderMccarthey87 10 років тому +1

    Are the keywords protected private and public meant to help manipulate inheritance or are they necessary also to encapsulation? Is encapsulation necessary for a all functional programs?

    • @waqas361
      @waqas361 10 років тому +1

      'private' is used to enforce encapsulation (usually for properties)
      'public' is used so a method can be accessed by other classes
      encapsulation is necessary for object-oriented programming

  • @AbadFarrukh
    @AbadFarrukh 5 років тому

    10 years later, still good!

  • @billythesunbeltsamurainapi3670
    @billythesunbeltsamurainapi3670 7 років тому

    with inheritance , do subclasses inherit private variables/methods? Do you just do getters and setters to acquire private variables ?

  • @thestarinthesky_
    @thestarinthesky_ 5 років тому

    Thank you teacher. You are by far the best!

  • @DoitiEtok
    @DoitiEtok 13 років тому

    @deathdealer13cat Did you start at video 1? Because the first 3 or 4 is setting it up correctly...

  • @TheaDragonSpirit
    @TheaDragonSpirit 12 років тому

    "So erm... make sure you spell a couple of things wrong there!" Finally someone who teaches people to not be pedantic about spelling. It's so limiting to a artist. :-)

  • @powerhouse8522
    @powerhouse8522 10 років тому

    U cleared so much shit up for me then reading this new java book I got. Thx, keep it up man.