Java abstraction 👻

แชร์
ฝัง
  • เผยแพร่เมื่อ 7 ก.ย. 2024

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

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

    //******************************************
    public class Main {
    public static void main(String[] args) {

    // abstract = abstract classes cannot be instantiated, but they can have a subclass
    // abstract methods are declared without an implementation

    //Vehicle vehicle = new Vehicle();
    Car car = new Car();

    car.go();
    }
    }
    //******************************************
    public abstract class Vehicle {

    abstract void go();
    }
    //******************************************
    public class Car extends Vehicle{
    @Override
    void go() {
    System.out.println("The driver is driving the car");

    }
    }
    //******************************************

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

    such a godlike explanation what the heck

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

    WTH... I have read full chapters on this topic and didn't come away with this clarity. You have earned a subscriber.

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

    I started learning Java through an online course, which is terrible at explaining things, leaving me confused lot of the time. Then comes BRO, who explains everything so simply and elegantly that I have no problems understanding it! Thank you BRO!

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

    I don't understand English a lot, but with this guy, I'm understanding 90%.
    Muito obrigado ✌️
    From Mozambique🇲🇿

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

      Hey, Juvenal! How is your Java-learning going on?

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

      @@shalomerror6236 it's going well

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

      méquié Juvenal ainda fazes Java?

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

      @@hero_bsb6314 parei há bom tempo.

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

      Hi, do what I do. Goto settings and select playback speed. I lowered it to 70%,S, that way I can follow what he is saying one way or another. good luck

  • @SinghB4
    @SinghB4 ปีที่แล้ว +15

    Missed classes because I was sick and your videos helped me so much in so little time. The best 🙌🏼

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

    I love you. Someone who can actually explain things!!!

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

    Bro; you have no idea how much you've helped me so far to learn Java. Any doubts I come here, looking for an example that you have,no doubt thank you, sincerely. - Never thought a bro' would save my ass this way. Love you and admire you.

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

    "and they might think ur crazy".. bro ur the goat of explaining java

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

    Honestly, your videos are saving me this semester. You explain it better than my professor, thank you for making content like this.

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

    This is the best Java tutorial for beginners, so you can learn Java and English in one hit. Please keep going! I vote for Java advance tutorial. Thanks a lot Bro

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

    Just made a comment for prayer to TH-cam algorithm ❤❤❤❤❤

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

    Your videos gives everyone a very clean start. This is great because we can easily build on that using other resources.

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

    thank you bro, my professor didnt explain this well and now i totally get it

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

    the car dealership example

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

    WOW..now is so easy for understanding!Thanks

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

    thank you so much for the explanation, you are the best!!! You did in 5 minutes what my professor was not able to do the whole semester.

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

    This my 6th/7th video in this channel, Man!!!! I got to say this, yo explanations are spot on and explaining in a logical way make really sense on each of the topics. Good luck and keep doing

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

    I understand abstraction like, A parent(superclass) has money and wants to give this money( variables/Methods) to his children and each child uses his money as he wants!

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

    thank you bro, I am using your videos to learn java, very helpfull to me, good luck, keep up the good work !!!

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

    I have been avoiding any instance that would make me use abstract classes cos the articles I read before never explained it clearly but I think this is the safest way to me now. I have been creating classes and just making things simple by using access modifiers, but yeah, thumb up Bro.

  • @NotYou-xk2bo
    @NotYou-xk2bo 2 ปีที่แล้ว +1

    Another great and easy to understand video

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

    Great video! For the ones out there who are quite confused with the given example, another similar code snippet is like this:
    //Vehicle(superclass)
    //Bike, Car, Boat (all are subclasses and uses the extends keyword)
    Vehicle a = new Car();
    Vehicle b = new Bike();
    Vehicle c = new Boat();
    Vehicle[] test = {a, b, c};
    This is much more understandable and less confusing for some.
    However, if there's a unique method present on one of those three subclasses above (for example, like void printCarModel() in the Car class only) that is NOT present in the Vehicle superclass, you would need to use the example code shown in the video. If we try to access the printCarModel() method:
    a.printCarModel();
    It would result in an error since the type of 'a' is 'Vehicle' and not 'Car' (because we did Vehicle a = new Car(); and there's no such printCarModel() in Vehicle)
    Use:
    Car a = new Car(); instead to access that unique method.

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

      You could also typecast the vehicle into a car to access the method
      I also have one question that I'm confused about abstract classes
      What's the point of them? In this video he said it's to add a further layer of security to prevent someone using too vague or broad of a class and trying to make an object out of that but can't you just solve that by not making that class at all
      Is it because we need the superclass because it makes writing subclasses quicker because we can just use the super keyword to access all the general shared information that the subclasses have with the superclass, that way it encapsulates code more or are there any other reasons

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

    Best video to learn about Abstract Classes.

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

    I LOVE these explanations, the example with the dealership and the vagueness was extraordinary. 💙
    Just one thing that's still keeping me from fully diving into everything: I sometimes miss the practical use. Why would I wanna prevent somebody from instantiating the abstract class? Why do I need to send values to a constructor and not just use the Main class? Any idea how to untie this knot in my brain (which lets me think a miss the very basics of Java)?

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

    Thank you for this video, I'm just about done reading the pdf I have in my coding class because it just goes on; I've never been huge on reading instructions. This gets straight to the point and makes the purpose of it obvious.

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

    Nice Bro

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

    Cristal clear! Thanks bro!

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

    Good videos , very helpful , we need a mysql tutorial to complete the full stack dev

  • @nouraldinurfan5024
    @nouraldinurfan5024 26 วันที่ผ่านมา

    thanks for helping us.

  • @danny.3036
    @danny.3036 3 ปีที่แล้ว +3

    Thanks, Bro! ☕ You're awesome!

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

    Thank you man for this new old tutorial

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

    awesome video

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

    Great explanation, very helpful!

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

    i finally understand abstract class, like the "why?" of this topic

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

    anjay, langsung paham gw, keren bang, lanjutkan kerjamu

  • @augischadiegils.5109
    @augischadiegils.5109 3 ปีที่แล้ว +3

    Another awesome video thanks bro :)

  • @BereketBelete-o2d
    @BereketBelete-o2d หลายเดือนก่อน

    Brilliant! Keep it up!

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

    thanks you, I am brasilian and dont understanding ingles very, but you tell so good!

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

    good stuff every time you hit the nail on the head quickly and clearly. let me know when your bible is ready i need a copy... Bro Code Bible,... never leave the house without it

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

      Thou shall not use many 'else if' statements

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

    Nice bro... this made it sooo simple to understand! Thx

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

    Thanks for the video and the knowledge you offer!

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

    simple and awesome like always

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

    This was a great example

  • @deez-48
    @deez-48 ปีที่แล้ว

    thanks that helped me remember the concept

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

    Good explanation. Do you need to have a regular method inside an abstract class since an abstract class cannot instantiate objects?

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

    best channel on youtube.

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

    That's awesome

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

    Thanks for clear cut explanation.

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

    Thanks for the explanation

  • @Muhammadfaisal-kd9kx
    @Muhammadfaisal-kd9kx 10 หลายเดือนก่อน

    easy to understand thankyou

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

    nice ❤💛💚

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

    Many thanks! Stay healthy, stay happy, Bro Teacher!

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

    Very helpful, thank you.

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

    Thanks for the video

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

    Perfect

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

    You are a legend!

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

    great

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

    number one

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

    Sir, I have two questions:
    1. Can an abstract class have a normal (non-abstract) method?
    2. Can a normal class have an abstract function?

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

      Hello Arka! Good questions
      1. An abstract class will need static methods since we cannot create an instance of an abstract class
      2. A normal class cannot have abstract methods

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

      @@BroCodez Thanks!!! 👍

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

      @@arkamukhopadhyay2177 abstract class can hove normal method

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

    nice job bro

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

    Extraordinary work

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

    great video , thank you !

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

    This really helped me. Thank you.

  • @aryan-ko3il
    @aryan-ko3il 11 หลายเดือนก่อน

    Love you, from France

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

    youre just great .

  • @user-zq6yx7of5f
    @user-zq6yx7of5f ปีที่แล้ว

    Thank you very much!!

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

    Nice.

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

    Thanks for the class

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

    very well explained!

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

    nice video

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

    Clear explanation. Thank you Bro -:)

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

    Hi there was watching this on the playlist I've gotten confused with interfaces and abstraction Do you have any websites or videos explaining the main differences ?
    Thankyou in advance (videos are really helpful saving me on my CS degree as a first year xD)

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

    best person in the world

  • @user-wv1in8fq4b
    @user-wv1in8fq4b 7 หลายเดือนก่อน

    liking it

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

    Bro is the best

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

    Thanks, Bro!

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

    appreciate it!

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

    👏👏👏👏

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

    great ! thanks !

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

    perfect

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

    thanks bro

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

    THANKS BRO!

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

    nice

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

    Super

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

    so vehicle. much abstract

  • @user-ju2tj3kr6n
    @user-ju2tj3kr6n 3 หลายเดือนก่อน

    Thanks

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

    love you bro

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

    Thank you!

  • @janel-qy1ex
    @janel-qy1ex 2 ปีที่แล้ว

    👍👍👍👍👍👍

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

    Nice job again!!

  • @o.jpinzon1854
    @o.jpinzon1854 8 หลายเดือนก่อน

    super!

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

    right on the point no bullshit

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

    Hey you many thanks to you!!!

  • @user-hf8fv2jm1o
    @user-hf8fv2jm1o ปีที่แล้ว

    Thank you

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

    best ever

  • @devbhatii
    @devbhatii 22 วันที่ผ่านมา

    crazy

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

    Thank you so much sir.

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

    Do we have to make our superclass abstract in every situation?

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

    thank you bro