Java abstraction 👻

Поділитися
Вставка

КОМЕНТАРІ • 204

  • @BroCodez
    @BroCodez  4 роки тому +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");

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

  • @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.

  • @SinghB4
    @SinghB4 Рік тому +15

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

  • @juvenalbaera2641
    @juvenalbaera2641 2 роки тому +45

    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

  • @a1rman906
    @a1rman906 Місяць тому

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

  • @donuteater7774
    @donuteater7774 4 місяці тому +1

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

  • @Pzdrs
    @Pzdrs 3 роки тому +92

    such a godlike explanation what the heck

  • @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

  • @mohammadreza1414
    @mohammadreza1414 2 місяці тому

    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

  • @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.

  • @elionayzuridasilveira4140
    @elionayzuridasilveira4140 4 місяці тому

    Thank you man for this new old tutorial

  • @viktoriyapetrova8692
    @viktoriyapetrova8692 5 місяців тому

    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.

  • @juanbaquero8628
    @juanbaquero8628 7 місяців тому +1

    Cristal clear! Thanks bro!

  • @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 !!!

  • @Armadder
    @Armadder 10 місяців тому

    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.

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

    Best video to learn about Abstract Classes.

  • @BereketBelete-o2d
    @BereketBelete-o2d 2 місяці тому

    Brilliant! Keep it up!

  • @jerryysen
    @jerryysen 7 місяців тому

    the car dealership example

  • @sanskritigiri
    @sanskritigiri 10 місяців тому

    This was a great example

  • @deez-48
    @deez-48 Рік тому

    thanks that helped me remember the concept

  • @nouraldinurfan5024
    @nouraldinurfan5024 Місяць тому

    thanks for helping us.

  • @NotYou-xk2bo
    @NotYou-xk2bo 2 роки тому +1

    Another great and easy to understand video

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

    Great explanation, very helpful!

  • @jasonpoonia
    @jasonpoonia 2 роки тому +1

    You are a legend!

  • @soumelee5661
    @soumelee5661 Рік тому

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

  • @hgatl
    @hgatl 3 роки тому +2

    awesome video

  • @augischadiegils.5109
    @augischadiegils.5109 3 роки тому +3

    Another awesome video thanks bro :)

  • @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?

  • @DiyakoAdnanAbdullahWahab
    @DiyakoAdnanAbdullahWahab 7 місяців тому

    best channel on youtube.

  • @jahed1311
    @jahed1311 2 роки тому

    youre just great .

  • @aryan-ko3il
    @aryan-ko3il 11 місяців тому

    Love you, from France

  • @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 6 місяців тому

      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

  • @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

  • @yonasfikadie5323
    @yonasfikadie5323 Рік тому

    nice ❤💛💚

  • @arkamukhopadhyay2177
    @arkamukhopadhyay2177 4 роки тому +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  4 роки тому +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 4 роки тому +1

      @@BroCodez Thanks!!! 👍

    • @waleedahmed396
      @waleedahmed396 3 роки тому +2

      @@arkamukhopadhyay2177 abstract class can hove normal method

  • @Bastyanul
    @Bastyanul 2 роки тому

    Thanks for the video and the knowledge you offer!

  • @jessepen2
    @jessepen2 Рік тому

    THANKS BRO!

  • @david_jn24
    @david_jn24 Рік тому

    number one

  • @huuloc8719
    @huuloc8719 2 роки тому

    Nice.

  • @ymmaaarrrr
    @ymmaaarrrr Рік тому

    nice video

  • @xXMaDGaMeR
    @xXMaDGaMeR 2 роки тому

    love you bro

  • @曾毓哲-b1t
    @曾毓哲-b1t Рік тому

    Thank you very much!!

  • @thomas_1611
    @thomas_1611 Рік тому

    Bro is the best

  • @DurgaSaathwikKolla
    @DurgaSaathwikKolla 13 днів тому

    Thank you bro

  • @aliozeir4546
    @aliozeir4546 2 роки тому

    perfect

  • @supersakib62
    @supersakib62 2 роки тому

    Thanks for clear cut explanation.

  • @huylee4721
    @huylee4721 4 місяці тому

    nice

  • @o.jpinzon1854
    @o.jpinzon1854 9 місяців тому

    super!

  • @lmao9619
    @lmao9619 4 місяці тому

    best person in the world

  • @michael_scarn_
    @michael_scarn_ Рік тому

    Thank you Bro, you're the best!

  • @tamekkaknuth9612
    @tamekkaknuth9612 2 роки тому

    thank you !!

  • @soumyadeeppatra5478
    @soumyadeeppatra5478 2 роки тому

    cool bro

  • @LushPleiades
    @LushPleiades Рік тому

    thanks bro

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

    great ! thanks !

  • @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)

  • @rinadem5219
    @rinadem5219 Рік тому

    best ever

  • @yousifalisyed5504
    @yousifalisyed5504 Рік тому

    Thanks for the explanation

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

    Super

  • @Muhammadfaisal-kd9kx
    @Muhammadfaisal-kd9kx 11 місяців тому

    easy to understand thankyou

  • @YouTube4u95
    @YouTube4u95 Рік тому

    Very helpful, thank you.

  • @beboadel1241
    @beboadel1241 Рік тому

    thank you

  • @dllm3tommy741
    @dllm3tommy741 11 місяців тому

    Thanks for the video

  • @PoorwayTraning
    @PoorwayTraning Рік тому

    thanks

  • @mihanfernando9890
    @mihanfernando9890 Рік тому

    right on the point no bullshit

  • @luisantonio7191
    @luisantonio7191 Рік тому

    Thanks for the class

  • @zaqimegantara1177
    @zaqimegantara1177 Місяць тому

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

  • @shalajko
    @shalajko 3 роки тому +2

    so vehicle. much abstract

  • @CSstudent_1001
    @CSstudent_1001 4 місяці тому

    👏👏👏👏

  • @devbhatii
    @devbhatii Місяць тому

    crazy

  • @tamekkaknuth9612
    @tamekkaknuth9612 2 роки тому

    Nice job again!!

  • @janel-qy1ex
    @janel-qy1ex 2 роки тому

    👍👍👍👍👍👍

  • @LudObrzygowiony
    @LudObrzygowiony 11 місяців тому

    cool vid

  • @alanjames-dev
    @alanjames-dev 3 роки тому +1

    Thanks

  • @Hirenji
    @Hirenji Рік тому

    thank youu broooo

  • @tukwasiibwemartin1587
    @tukwasiibwemartin1587 Рік тому

    Thanx for this. Under what circumstances does a class become abstract?

  • @gamer0-0girl
    @gamer0-0girl 3 місяці тому

    learned it whole

  • @__joshplays.
    @__joshplays. 4 місяці тому

    Currently our subject lessons right now

  • @glorysonhorace3265
    @glorysonhorace3265 2 роки тому

    Thanks broh

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

    Nice bro, thanks!

  • @jadronaldo566
    @jadronaldo566 Рік тому

    i'm the 50000TH viewer !! thanks broo!!

  • @dildil6815
    @dildil6815 Рік тому

    thank you brooooooooo

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

    Thank you so much sir.

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

    very useful

  • @Simis999
    @Simis999 2 роки тому

    And then God sent us Bro

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

    Thank you so much

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

    Yea!! 1 prayer!!!

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

      thanks for the prayer Lucy!

  • @pa-305
    @pa-305 3 роки тому

    best broooo

  • @majid1885
    @majid1885 2 роки тому

    Thanks Bro

  • @nanto6865
    @nanto6865 Рік тому +1

    bro's coding

  • @gsabella4
    @gsabella4 Рік тому

    In BroCode we trust

  • @anjapietralla5767
    @anjapietralla5767 8 місяців тому

    😃

  • @chillfill4866
    @chillfill4866 2 роки тому

    Why use abstract class over interface?

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

    Amazing video as always bro! One question, how do you get Eclipse to auto-complete 'System.out.println();' when you type sysout? I can't figure out how to. Thanks!!

    • @johneltins9822
      @johneltins9822 3 роки тому +5

      you have to utilize the command (ctrl + space ) after the sysout

    • @bruce9067
      @bruce9067 3 роки тому +2

      @@johneltins9822 Thankyou so much!! It works!

    • @fuzzywuzzy318
      @fuzzywuzzy318 2 роки тому

      type sout

    • @adityaranjansahoo6261
      @adityaranjansahoo6261 Рік тому +1

      just type syso ctrl+space...I am also new and have completed Java upto OOp implementation soon will start 2-d graphics

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

    need new videos!

  • @gentle9964
    @gentle9964 Рік тому

    I started learning Java through an online course, which is terrible at explaining things

  • @skay8096
    @skay8096 Рік тому

    broo

  • @alexyakoveno4682
    @alexyakoveno4682 2 роки тому

  • @meggieelo
    @meggieelo 2 роки тому

  • @Jan-fw7qz
    @Jan-fw7qz 3 роки тому

    Thank you so much 😿💕