#67 More on Interfaces in Java

Sdílet
Vložit
  • čas přidán 8. 09. 2024
  • Check out our courses:
    Enterprise Java Spring Microservices: go.telusko.com...
    Coupon: TELUSKO10 (10% Discount)
    Master Java Spring Development : bit.ly/java-sp...
    Coupon: TELUSKO20 (20% Discount)
    Udemy Courses:
    Java:- bit.ly/JavaUde...
    Spring:- bit.ly/SpringU...
    Java For Programmers:- bit.ly/javaPro...
    For More Queries WhatsApp or Call on : +919008963671
    website : courses.telusk...
    In this lecture we will learn:
    - Implementation of multiple interfaces
    - Inheritance in between interfaces
    - Method calling of an interface
    #1
    - We can have a class implementing multiple interfaces.
    class B implemets A,X
    {
    }
    (here, A and X are two different interfaces)
    - Implementation of all the methods that are present in those interfaces should be given in a class.
    - Inheritance is also valid in between interfaces.
    - Inheritance can be achieved in between interfaces by using the extend keyword.
    - Whenever you create a reference of an interface and create an object of a class, then you can only call those methods by that reference that are present in that interface of which the refernce is created.
    - Methods of another interface can be called by using another reference variable for that interface with the object of a class.
    #2
    *
    class - class - extends
    class - interface - implements
    interface - interface - extends
    Github repo : github.com/nav...
    Java:- bit.ly/JavaUde...
    Spring:- bit.ly/SpringU...
    More Learning :
    Java :- bit.ly/3x6rr0N
    Python :- bit.ly/3GRc7JX
    Django :- bit.ly/3MmoJK6
    JavaScript :- bit.ly/3tiAlHo
    Node JS :- bit.ly/3GT4liq
    Rest Api :-bit.ly/3MjhZwt
    Servlet :- bit.ly/3Q7eA7k
    Spring Framework :- bit.ly/3xi7buh
    Design Patterns in Java :- bit.ly/3MocXiq
    Docker :- bit.ly/3xjWzLA
    Blockchain Tutorial :- bit.ly/3NSbOkc
    Corda Tutorial:- bit.ly/3thbUKa
    Hyperledger Fabric :- bit.ly/38RZCRB
    NoSQL Tutorial :- bit.ly/3aJpRuc
    Mysql Tutorial :- bit.ly/3thpr4L
    Data Structures using Java :- bit.ly/3MuJa7S
    Git Tutorial :- bit.ly/3NXyCPu
    Donation:
    PayPal Id : navinreddy20
    www.telusko.com

Komentáře • 19

  • @grrlgd3835
    @grrlgd3835 Před rokem +6

    I started with Navin 3 years ago. I've watched lots of others since aswell but he remains the best.

  • @masteradvisor594
    @masteradvisor594 Před rokem +2

    sir u r perfect always do crisp video upto point. Thank u so much for such amazing playlist.

  • @psnvenkat2284
    @psnvenkat2284 Před 11 měsíci +3

    Also there are new features for interfaces in new JDK version, where we can use default method and static method with implementations inside a interface class. FYI

  • @nguyenquanghau7158
    @nguyenquanghau7158 Před rokem +3

    I have an idea for that, we just change type data, for example, we declare that A obj = new B(), and we could you some methods that belong to the A class. But we want to use the run function that belongs to the B class, simply using this command ((B) obj).run(). It will work well.

    • @suraprashanthreddysura487
      @suraprashanthreddysura487 Před rokem

      Yes it worked, but don't you think it is written purposely . Like behind it we have a reason?

    • @psnvenkat2284
      @psnvenkat2284 Před 11 měsíci

      This is call method casting for obj reference. Am i correct?

    • @merrylia8316
      @merrylia8316 Před 10 měsíci

      is this a one-time use(liek after that command the reference is still A)? or does is change the reference of the obj from A to B?

  • @merrylia8316
    @merrylia8316 Před 10 měsíci +1

    great explanation. thank you so much 🤩🤩

  • @ryansinclaire8463
    @ryansinclaire8463 Před 10 měsíci

    You're saving my life! Thank you!

  • @batambuzestephen8243
    @batambuzestephen8243 Před 6 měsíci

    I also observed you can extend a normal class and implement an interface within one class

  • @Trading_Club007
    @Trading_Club007 Před 10 měsíci

    you're saving my money

  • @jatinsharma3792
    @jatinsharma3792 Před 8 měsíci

    You missed why we use the default private and static method in interface after Java 8 ?

  • @vinny4161
    @vinny4161 Před rokem +2

    Better to create class B object with reference B so that we can access all methods of interfaces and class B

    • @TuxTuxedo-oc9kg
      @TuxTuxedo-oc9kg Před rokem

      I asked myself the question and tried it out since I was not sure what would happen.
      All of a sudden I love interfaces lol. You can restrict by making the object of either type 1 or 2 (interface 1 or 2) or you can make it access all interfaces by instantiating an object with the type of the implementing class so it gets access to both interfaces since the class implements both.
      even works if the interfaces methods have the same name, since they have no body you have to implement the method body once yourself.
      cool stuff!

    • @merrylia8316
      @merrylia8316 Před 10 měsíci +1

      ​@@TuxTuxedo-oc9kgomg I just realized by reading your comment that I can access the methods in both interface A and X by creating an object of class B with class B as the reference. different approach than what sir navin did in this video.

  • @target__iit
    @target__iit Před 6 měsíci +2

    (Next Video) Need of Interface in Java -> czcams.com/video/AG_7wWFBquQ/video.htmlsi=Pb8fNRY3lLjxzrL7

  • @bhaskarreddy.b2818
    @bhaskarreddy.b2818 Před rokem

    Sir even class b also should become abstract because the methods we using are abstract in interface class

    • @uday2159
      @uday2159 Před rokem

      The B class should be abstract when we not define all abstract methods in it and later we can define remaining methods in sub class of B.
      Then finally the subclass of B should be non abstract class.

  • @surya-xy7wc
    @surya-xy7wc Před rokem

    Sry mapla I'll not interested😜