Java Video Tutorial 15

Java Video Tutorial 15

FavoriteLoadingAdd to favorites

Code is Here:

Java468x60

Best Java Book :

In this part of the Java Video Tutorial I cover interfaces, abstract classes, abstract methods and more.

You need interfaces and abstract classes because Java doesn’t allow you to inherit from more than one other class. You would use an interface when you want to force the user of the interface to create every method in the interface.

You use an abstract method when you need some flexibility.

source

By |2019-04-16T17:36:53+00:00April 16th, 2019|Java Video Tutorials|25 Comments

25 Comments

  1. teja madu April 16, 2019 at 5:36 pm - Reply

    sir you have good knowledge can you explain little slow so that begineers like me can understand it

  2. JT Saiyan April 16, 2019 at 5:36 pm - Reply

    But why do we need these if we can just create these methods inside the car class?

  3. Nimr Sawafta April 16, 2019 at 5:36 pm - Reply

    final +abstract = interface ?

  4. Nimr Sawafta April 16, 2019 at 5:36 pm - Reply

    so its more like abstract but you dont have to witter abstract

  5. Erik Mueller April 16, 2019 at 5:36 pm - Reply

    An interface is a way of grouping classes. The reason for this is that any class that implements that interface must "do" all the methods that are written in that interface. So if there is an interface called "animal" which has methods: eat, sleep, walk, run, jump, then we have a bunch of classes for different types of animals, we would "group" all the different animal classes together by making them all implement the interface which means they must all "do" the methods in the interface, because those methods are common to them all. If that sounds exactly like inheritance with an abstract parent class that's because it is. The reason that interfaces are sometimes used instead of regular abstract class inheritance is because in Java a class can only have one parent class but can have man interfaces. If a class could have multiple parent classes then there would be little point in interfaces. The interface also "guarantees" how to communicate with the class, so that there is set standard that all the classes must follow to make everything straightforward and streamlined.

  6. onesmo jason Polite April 16, 2019 at 5:36 pm - Reply

    VERY GOOD

  7. Sugan Ganesan April 16, 2019 at 5:36 pm - Reply

    Good video if you're going for a recap. Thanks Derek!

  8. NCB CODE April 16, 2019 at 5:36 pm - Reply

    What are the purposes of abstract classes and interfaces? I know they'd be talked about later, but if you can just copy and paste the code from the abstract class/interface, then why do it? Thanks.

  9. Miketar2424 April 16, 2019 at 5:36 pm - Reply

    I had to write my own code to understand it. I made a Vehicle class and set it to abstract. Then , made two sub-classes : Car and Truck. The interface was useRadio. The car implemented the radio interface, but the truck did not. One interesting thing I found: when you make the instance as: Vehicle car = new Car(), you will not get the radio functions , because the useRadio interface was not implemented in the Vehicle class. However, you may cast the car like so: ((Car)car).setRadioFunction(), and you will then gain access to your interface methods.

  10. Adrian Salabanzi April 16, 2019 at 5:36 pm - Reply

    Thanks !!

  11. border April 16, 2019 at 5:36 pm - Reply

    Hello sir, I have somme problem: Vehicle is not abstract and does not override abstract method setCarStrength(int) in Crashable. may you help me pls

  12. Bader Almutairi April 16, 2019 at 5:36 pm - Reply

    Man you are so awesome thanks a lot

  13. Marek Kubiak April 16, 2019 at 5:36 pm - Reply

    Yyyhhyyyyyhhbdgyegdh Derek! Thanks, well explained

  14. Jbdoster April 16, 2019 at 5:36 pm - Reply

    Around 1:40 aren’t we advised to not put constants into interfaces unless those constants are placed in a final class?

    I know you mentioned you are only focusing on syntax; it’d be cool if you could make a video on best practices for interfaces too!

  15. peraruor April 16, 2019 at 5:36 pm - Reply

    Thanks Derek, realy simple but at the same time complete explanation on interfaces. However, I got a question on interfaces if you please. I've seen on patterns examples the use of interfaces as variables. Why you need to use an interface as a variable type on a program? If interfaces don't have methods implementation, Why used as a variable? Thanks again. Pedro.

  16. Tom Anonym April 16, 2019 at 5:36 pm - Reply

    Nice video.

  17. Kendall Christlieb April 16, 2019 at 5:36 pm - Reply

    I can't tell you how helpful your channel has been to me to supplement my online college class where I have just felt lost reading the textbook. Thank you so much! Straightforward and approachable – couldn't ask for more!

  18. function myFunction April 16, 2019 at 5:36 pm - Reply

    no explanation Im still confuse.. I just wasted my time watching this video

  19. Sangeeta Kushwaha April 16, 2019 at 5:36 pm - Reply

    Wow, ur r awesome sir
    Looks like ur are really very good at coding
    Thanks for the video sir that was a great help

  20. Yixiong Wu April 16, 2019 at 5:36 pm - Reply

    Even though your speak pretty fast but your explaining if pretty clear

  21. Devon Langendoerfer April 16, 2019 at 5:36 pm - Reply

    Great video, thanks!

  22. Norbert Hreskó April 16, 2019 at 5:36 pm - Reply

    So, basically interfaces are just guidelines ? Does it mean that if I want to make something drivable, it just tells me that I need to implement all the methods from the interface in order to do so ?

  23. IndeedAudio April 16, 2019 at 5:36 pm - Reply

    I wish I could like your videos twice. I am dying when I read the books, not every book but most of them. After your videos I can skim the book for any other useful information and not reading it as a whole … Many thanks!!

  24. Steve Ho April 16, 2019 at 5:36 pm - Reply

    Can someone help me understand this? I dont get the point of using an interface. Can't we just add more methods to the object class?

  25. Золотая Невеста April 16, 2019 at 5:36 pm - Reply

    Hi Derek. You omitted the access modifier and "abstract" keyword when you declared members of the interface why is that?

Leave A Comment

*