Java Interface Example:Java Tutorial for Beginners

preview_player
Показать описание
What is an Interface?
An interface is just like Java Class, but it only has static constants and abstract method.

Syntax for Declaring Interface –
interface {
//methods
}

Like, share and subscribe our channel for more videos.

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

Sincerely,
Guru99
Рекомендации по теме
Комментарии
Автор

Thank you for making this so easy to understand!

logicNreason
Автор

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.

lashtal
Автор

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.

Claymore
Автор

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.

painnutplay
Автор

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

mithuns
Автор

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

ΑντρέαςΣωτηρίου-πγ
Автор

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?

newold
Автор

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

TheBrinkofDestruction