Java Interface Example:Java Tutorial for Beginners

///Java Interface Example:Java Tutorial for Beginners

Java Interface Example:Java Tutorial for Beginners

FavoriteLoadingAdd to favorites

the following tutorial discusses issues with multiple inheritance and why java does not allow it. It also introduces interfaces in java.
What is an Interface?
An interface is just like Java Class, but it only has static constants and abstract method.

Java468x60

Syntax for Declaring Interface –
interface {
//methods
}

Like, share and subscribe our channel for more videos.
Watch more videos on our YouTube channel at
READ this as a book on Amazon by viewing at
Visit our website for more! www.guru99.com
Read our blogs in
FACEBOOK! Would you prefer to watch more about us? Like our page for more
TWITTER! Tweet for us on Twitter with #guru99 and follow us on
LinkedIn! Follow us here

THANKS! We appreciate you reading this and hope you have a wonderful day!

Sincerely,
Guru99

source

By |2020-01-01T00:54:55+00:00January 1st, 2020|Java Video Tutorials|15 Comments

15 Comments

  1. Guru99 January 1, 2020 at 12:54 am - Reply

    Check out our FREE Real Time JAVA Project: https://www.guru99.com/live-java-project.html

  2. Kirtijyoti Senapati January 1, 2020 at 12:54 am - Reply

    Thank you for your time

  3. ihonestytruthful January 1, 2020 at 12:54 am - Reply

    short and sweet

  4. The Brink of Destruction January 1, 2020 at 12:54 am - Reply

    so much for a programming tutorial, just a simple explanation posing as an advertisement

  5. believe theUnbelievable January 1, 2020 at 12:54 am - Reply

    can interface be  a type and if yes what are the advantages of that??

  6. Nicholas Berglund January 1, 2020 at 12:54 am - Reply

    Thank you! Great video!

  7. RAJESH KUMAR ARUMUGAM January 1, 2020 at 12:54 am - Reply

    Super explanation Thanks

  8. tangudu gayatri January 1, 2020 at 12:54 am - Reply

    sir u missed some of the videos

  9. Mithun S January 1, 2020 at 12:54 am - Reply

    But….Tell me the solution for "Play" method using "Interface" for Combo Drive!!!

  10. Mohammed Viso January 1, 2020 at 12:54 am - Reply

    Thank you so much

  11. Keenan Romain January 1, 2020 at 12:54 am - Reply

    Thank you for making this so easy to understand!

  12. painnutplay9 January 1, 2020 at 12:54 am - Reply

    Correct me if i'm wrong, but this definition of an interface got kind of old since Java 8 came out. Now there can be functional interfaces and now interfaces apparently can implement default and static methods making the interface not 100% abstract.
    Which makes me think, if these is affecting in any way the utility of abstract classes since now interfaces by themselves can work more like an abstract class now.
    Also lambdas themselves (i really don't know yet how to use them) as I red in many sites and saw on many vieos, they are more functional programming based. So if Java is supposedly a strong OOP language, why should it step away from that parading into another ones? I might be thinking the wrong way but implementing an interface in an anonymous inner class when learningn it was easier to understand than the lambda way and I think thats because this is the OOP way to do it being Java OO.

  13. lashtal January 1, 2020 at 12:54 am - Reply

    @Claymore2408 Was just about to point this out, but you beat me to it, 8 months ago!

    It's allowed in languages like C++, which is perhaps one of many reasons why C++ is considered harder to become competent in than Java (despite the fact that Java is also a pretty technical language involving YEARS upon YEARS of study, depending on how deep one wishes to go into it… think Blosch, or a Senior Software Developer rank who specializes in J2EE)

    This "model" is also known as the "Deadly Diamond of Death" or "DDD" [which is explained in the book aforementioned by yourself]

    The video touched the basic concept of Interface, but failed to show WHY Interfaces are integral from a DESIGN perspective, in lieu of methods inherited by superclasses which have the potential to cause conflicts.

    I appreciate the VISUAL representation of this information, however, I can't help but feel as people have a tendency of just shitting these kinds of vids out quickly for the views.

  14. new1old January 1, 2020 at 12:54 am - Reply

    I'm new to Java…why not just make a new class that supports whatever dog and pet are supposed to do and not worry about interfacing at all?

  15. Claymore2408 January 1, 2020 at 12:54 am - Reply

    This particular example was taken from the Java book "Head First Java, Second Edition", if i'm not mistaken unless this is a popular example of the interface.

Leave A Comment

*