Starting a programming video with a real world example. You nailed it. Beginners usually understand how to use interfaces, however, get confused or find it hard to understand the PURPOSE of using interfaces. This video explains the purpose. Great content.
@tristanlee11715 жыл бұрын
Am I the only one who is still confused
@corey3141594 жыл бұрын
I was too after first viewing. Then I watched it two more times and realized how great an explanation on interfaces this was!
@KoryGraphic4 жыл бұрын
You should have a read about interfaces from somewhere else just to know what he's talking about, then everything makes sense.
@mryup61004 жыл бұрын
@@KoryGraphic Yeah, I agree. This is very easy to understand now.
@HotFiya053 жыл бұрын
I just think he's going way too quickly. Seems like a synopsis
@DrSaav-my5ym2 жыл бұрын
@@KoryGraphic or he could just explain it in a way that could be understood having no knowledge of interfaces, i wouldn't mind a longer video
@RedEyedJedi7 жыл бұрын
I love the amount of detail you include in your videos. I am learning java so I can pass the Oracle exams and hopefully become a professional programmer. Coding is my favourite hobby besides playing the guitar so it would be amazing to actually get paid for doing something that I love doing. Thank you so much for taking the time to make these videos, it is really helping me.
@samuelmcalpin8761 Жыл бұрын
how's it going, are you currently working as a programmer yet??
@fahada783 Жыл бұрын
I admire your positive words thanks and keep going
@skyhigh94744 жыл бұрын
Straight to the point. That's how all others need to start their videos too.
@aashutoshtaikar50875 жыл бұрын
Nice explanation. But the biggest difference and an advantage of using interface over abstract class; is that an interface will allow developers to do multiple inheritance which might be needed in certain scenarios. And now that we can have method definitions inside interface we must use interface whenever possible. In 3:59 the instructor says the code will not compile due to ambiguity of two default methods, but he missed to mention that it can be resolved by overriding the implementation of default method wakeDJUp() in the MyCar class, effectively clearing out the ambiguity. Interfaces are really very powerful now. I will shortly post a code on github which explains this. But in all the the explanation is really nice, simple and precise. Thanks!
@thecallitaspadechannel27943 жыл бұрын
This makes so much more sense then where I read about it before, and under ten minutes too!!!
@JorgeEscobarMX7 жыл бұрын
I'm afraid that interfaces is a complex subject to be handled in a single video, yet this video was great as a tutorial/introduction to interfaces.
@JorgeEscobarMX7 жыл бұрын
I can see your point in 6:20, forcing another developer to understand your inheritence design will cause problems. Interfaces are free of that level of commitment and still work as intended.
@7654321romer Жыл бұрын
Great explanation, I loved that the video not too long despite the amount of detail.
@waverunzzz7 жыл бұрын
I appreciate the practical explanation of the contexts of using interfaces vs abstract classes. Thanks!
@deegeu7 жыл бұрын
Thanks for watching!
@payambassi87842 жыл бұрын
Hi thank you for the video, I'd just say that it all seems to be going too fast. I think it's always good, specially for computer sciencey stuff to go a little slower, and to explain any new concept from a few different angles.
@NelsonSteffens6 жыл бұрын
Your video has enlightened me. Thank you for explaining the differences between abstract classes and interfaces. It was very unclear to me before but after watching your video, it all makes total sense now! Great videos! Keep 'em coming!
@jeremiahnji67 жыл бұрын
Thank you for the video. Helped me a lot when creating interfaces for one of my applications. You made this two years ago but it is still helping people like me out :)
@victorejiofor81152 жыл бұрын
I would say that this is an informative video and the example of the self-driving cars you mentioned at the beginning of the video made the point of interfaces clear. Thanks very much
@fran14cruz3 жыл бұрын
Best teacher ever. My respects.
@gigajoules66364 жыл бұрын
Great video with the exception of the audio levels flicking between you whispering and then being absolutely deafening
@yuudaemones26246 жыл бұрын
Makes a Spaceballs reference 5 seconds into video... I already like this guy.
@raaznak Жыл бұрын
my right ear really enjoyed this vid
@DannydXL6 жыл бұрын
It's a bit hard to focus on this video with that music in the background.
@trancedman3 жыл бұрын
No wonder. It's kids music. Distraction everywhere.
@herionetbrine88263 жыл бұрын
Best example of what happens when living in a loud house. I tuned out the music from the start. I had to focus on trying to hear it, and even then it was only when you mentioned it was there at all. Damn.
@satioOeinas Жыл бұрын
This was very helpful! Thank you :)
@dantepillon2 жыл бұрын
This is a good explanation subscribed!
@jliebss_3 жыл бұрын
He explained more in 42 seconds than my textbook explained in 42 pages
@preetham19862 жыл бұрын
Omg your explaination is on point.
@mattsmith68284 жыл бұрын
you said "The most common use for interfaces is to hide the details of a class". I agree with everything else you said about interfaces, but this one statement doesn't make any sense to me. How does an interface HIDE anything? They just force classes & other interfaces that implement or extend them to implement it's methods.
@undrgrndhp Жыл бұрын
Great video, Thank you!
@DreBruh2 жыл бұрын
Hey these videos are great, wish you were still making videos. I hope you’re doing well sir
@adrianperez86954 жыл бұрын
Thank you for this video. Helped me understand interfaces better!
@gurmangill0097 жыл бұрын
Very well explained, Nice Job. Would be really nice to make a video about how everything is public in interface, interface contains constants and stubs(Mehtods without body) only. While in abstract class there can constants, members, stubs and defined members ( can be defined with any visibility) and much more.
@Binyam_G_Kahsay4 жыл бұрын
good way of teaching sir
@KayVirals5 жыл бұрын
This video was short and packed with lot of useful information. Love your videos... Thank you.
@anonmisfit Жыл бұрын
very helpful! I still struggle with grasping where to actually use interfaces instead of classes in real projects. Sure you can define structures, but where do I actually NEED that? I'm working on a 9 year-old project - implementing interfaces now for old and established functionalities seems far too risky at this point, and like a potential chore going forward.
@kehinde.abiodun7 жыл бұрын
Awesome video, now I understand these concepts better. Thanks so much
@harishchowdarysure88588 жыл бұрын
I have a one class who contain 5 methods But my requirement is in between 5 methods I want to apply locking mechanism that multiple thread can’t access at a time but rest 3 methods can be access by multiple thread at a time NOTE:Without using Synchronized key word
@deegeu8 жыл бұрын
Well you could use a simple semaphore (flag) to block when code is entered. You could use atomic variables (look at AtomicReference). You could also look at locks. This sounds like a homework problem... :)
@prathameshbhonkhade78014 жыл бұрын
Very well explained sir 😉
@xianchen19355 жыл бұрын
Soo... what's the main difference between acstract classes and interfaces?
@elmago48944 жыл бұрын
quote from a java book im reading, ."One of the most common Java interview questions is, “What is the difference between an interface and an abstract class?” This section provides you the most detailed answer to that question. An interface is not a class, but it does help create classes. An interface is fully abstract; it has no fields, only method definitions (skeletons). A class can implement an interface, and unless the class is abstract, it is forced to provide concrete implementations for them. Each method declared inside an interface is implicitly public and abstract, because methods need to be abstract to force implementing classes to provide implementations and are public, so classes have access to do so."
@jameslowell96564 жыл бұрын
You can implement multiple interfaces but can only extend one class at a time
@ifstatementifstatement2704 Жыл бұрын
Ok but what if someone creates a class that does not extend/implement the interface but yet implements their own version of those methods? Basically bypassing your interface/contract.
@KarolStoinski8 жыл бұрын
Awesome video!
@deegeu8 жыл бұрын
+Karol Stoiński Thank you!
@praveenchukka7 жыл бұрын
This is so clear!
@chrs-wltrs2 жыл бұрын
Wait, if you've got a bundle of constants that you want to include across your project, is it better to implement them as a final class, as opposed to an interface? Doesn't the necessity of class inheritance preclude any possibility of inheriting anything from an actual parent class? It seems like an interface would be easier.
@phoenixbrothers22118 жыл бұрын
Thank you for the energy you are putting on these videos, but for the most part they are more like recapping what the user already knows and not much like a tutorial. So what would be the point if the user already familiar with those concepts? If you could put yourself in the position of a learner who is new to all these concepts your videos would be much more educational for sure. Maybe back in time when you were learning yourself.
@deegeu8 жыл бұрын
+Phoenix Brothers Hm. I've been trying to start assuming no knowledge, and work from there. What do you think I could improve to make the videos more useful?
@tsi4ya6 жыл бұрын
I disagree. I used this vid as a refresher of what I already knew. If you are a beginner then you could cruse the channel or simply google it. In ep 38 he goes over Abstract Classes, which touch on Abstract Methods, if he did that hear that would make the vid to long and then be a turn off for views like me.
@tonnie70795 жыл бұрын
@@deegeu I am new to Java and I found this so helpful and even made notes, Interfaces have always confused me thanks for the video
@abieniakgog5 жыл бұрын
@@tonnie7079 - the same for me here :) I found it useful while looking for extending some topics from basic java tutorial online. @Deege U - thanks for the energy and smile in your eyes. Happy NY!
@zedzedder14265 жыл бұрын
I am learning Java, and I like it. But I got to a point in the course, which is basically the OCA book by Jeanne Boyarsky and Scott Seikoff, so I got to a chapter that is trying to explain lambdas. But it explains lambdas by talking about interfaces, which comes later in the course/book. I need to understand interfaces, but I can't learn the "how" if I don't understand the "why". This was the first explanation I found, that makes me feel comfortable with the notion of interfaces, because now I get why is an interface used.
@Abdulwahid-ru5wy7 жыл бұрын
well done men.You teach this concept v.well
@jonasbanhos73736 жыл бұрын
Great high level explanation! Thanks!
@amitrawat80757 жыл бұрын
Sir! You are awesome .. I'm feeling blessed that I found you :)
@lomoyang30345 жыл бұрын
Could one give me an example of under what situation we will call a default method from another interface? Thank You!
@StoneColdMagic8 жыл бұрын
Excellent Video - Subscribed! I've got a quick question for you. What happens if you implement 2 interfaces and they both have a method with the same name?
@piyushbisht17 жыл бұрын
You have to provide your definition of conflicting Method in implementing class otherwise compiler will give you an error
@hiddenblade9997 жыл бұрын
Having trouble understanding your argument for interfaces > inheritance. We can implement many interfaces in a class. But with inheritance we are restricted to the methods of the one class?
@deegeu7 жыл бұрын
The main problem is inheritance forces the user (another programmer) to create a derived class. If everything will always be under the control of one person, or the same team then it's not as much of an issue. The writer of the subclass must know the internal workings of the superclass, otherwise the subclass can be adversely affected by any evolution in the superclass. Much of the internal workings must be exposed through protected methods. This means you must give significant thought on how your class will be subclassed, heavily document it, and you have to test it by writing several subclasses. This doesn't mean inheritance is useless, but if you're just needing to provide a hook for some functionality to be called, interfaces are the way to go.
@daleoking17 жыл бұрын
hi nice video. Two things. Is Interface like a Struct in c++? and Is ActionListener an Interface? I am still confuse with this subject.
@michaelbrooks67135 жыл бұрын
Very good video. I do have one question though. You said that the method in an interface can only be void. However if you're implementing a Java Pattern like Strategy, don't you have to pass an object back to the decelerating interface? Thanks in advance.
@ghaliahabukhrs19487 жыл бұрын
Thank you very much , it is amazing information 🌸🌸
@Jacobluke1216 жыл бұрын
great video. What is the point in the interface, surely we could just declare the methods in the classes that require them rather than having an interface? TIA
@ersenosman46998 жыл бұрын
Thank for making this video. Very helpful. Would it be possible for you to cover Generics in Java next?
@deegeu8 жыл бұрын
+Ersen Osman Generics are coming very soon. I need to cover exceptions and some class types first.
@W0lfm0ther6 жыл бұрын
that shirt is everything
@salmankhandu38194 жыл бұрын
1) when to use interface and when to use abstract class. 2) after jdk8 what's major difference between interface and abstract
@NaveenKumar-bh5wk5 жыл бұрын
Thank you
@Kobe292616 жыл бұрын
Thanks man, you are doing awesome work!
@bryanbojorque5 жыл бұрын
This video for me creates more questions than closure. I'm probably slow but is that all?
@skullwise6 жыл бұрын
very helpful video. Why is it a bad idea to have an interface with only constant?
@donniedorko33365 жыл бұрын
That was very helpful thank you
@Joni67sinix5 жыл бұрын
excellent class!! thanksssss
@TheZerosteel3 жыл бұрын
SelfDrivable.super
@shawnl11554 жыл бұрын
Great material but I believe the gain is too high on the mic. It sounds like it's clipping when you are doing the voice over while showing the computer screen.
@sueason60415 жыл бұрын
Thank you so much!!
@relaxxxxx6206 жыл бұрын
Awesome video
@baalametsayid85968 жыл бұрын
Hey there! I'm currently working on building a composite class that needs to take methods from any one of six other classes, but needs to ONLY have access to a selection of one to several of those classes at a time, as well as the ability to change from one to the other. I plan to instantiate and release objects of those classes as a form of access control. Would an interface better serve this purpose?
@bobyenjoy37586 жыл бұрын
Sir, Very nicely made video. But it doesn't server any purpose. I doesn't help me understand how to use an interface.. :-((
@darkwingduck426 жыл бұрын
YOu have explained this very well!. I have already tried 5 other sources, and this was the best! Thanks Deege u!!
@mdzahidulislam29808 жыл бұрын
My question for you - i need to use 4 behavior from two interface and 2 from one and 2 from one.Both interface contains 4 methods/behavior.so i have to implement (or keep as empty) 8 method in my class.I dont want to do that.What would be good way around for this scenario.Thanks.
@samitee833611 ай бұрын
from the future, driverless cars now exist!
@MathP3r5 жыл бұрын
thank you !
@SamChalvet6 жыл бұрын
Where is your background? Looks like the Belledonne mountain range in France
@basuchandaki8 жыл бұрын
really coooool, super!
@akashnishad81288 жыл бұрын
Hi Sir, My Question may sound stupid to you but from long time i am having this doubt interface P { public void add(); public void sub(); } class C implements P { @Override public void add() { System.out.println("addition method"); } @Override public void sub() { System.out.println("substraction method"); } } class Test { public static void main(String [] args) { C c=new C(); c.add(); c.sub(); } } My question is that if there was no interface class still this code will work(few changes req) and we are the one who are proving definition for interface methods then what is the point of interface In short my point is if X and Y interface contains 4 methods each and class Z implements X,Y class Z has to provide method definition of 8 methods .....then what is the point of interface ....we can directly create Z class with 8 methods in it.
@25zsams8 жыл бұрын
i have the exact same question too : ( whelp!. someone explain please!
@loganphillips16748 жыл бұрын
Let me try to explain. And by the way this is not a stupid question at all, it was one that I asked and took me a long time to understand, I still don't completely know everything about interfaces. In your case, you could definitely create class Z with the 8 methods in it and class Z would work fine. That's not necessarily the point though. Interfaces are a key component to object oriented programming. Often in OOP, a programmer creates a class that another programmer can use. A key part of OOP is abstraction. When creating our classes, we want to hide the details of the implementation from who ever will end up using that class in their own program. Say that I create a class that describes different behaviors of robots. We can have various kinds of robots, but they all have the same behaviors. They just do those behaviors in a different way. Every robot walks, jumps, runs, and many other things but they do so depending on what kind of robot they are. So, I create multiple classes that allow someone to create different kinds of robot objects with the proper instance variables and instance methods. Now, someone else should be able to use my class and use it to control the robot in anyway they want without having to worry about the implementation. In other words, they don't have to worry how the code makes the robot work. They should never have to study my code at all. So, I create an interface. The interface explains what any robot can do. The user of my class doesn't need to know how I make the robot walk or jump or talk, but all he needs to know is that if he calls the methods on a robot that he has constructed, it will do those things. In this example, some polymorphism and inheritance would need to be used because we have different kinds of robots that have similar behavior. The interface explains what each method of my class does so that the user of the class can use the methods. The interface basically guarantees that the methods in the class will work the way that they are described. This makes it a lot easier for the user of my class to actually use it because he doesn't have to worry about how I created the class. All he knows is that the class does what I say it does. Another key idea to interfaces in Java is that it allows flexibility. Say that I have a method that makes the robot walk forward a certain number of steps. The user of my class has been using it for years, until one day I realize that there is a better way to write that method. So, I rewrite it. As long as my revision still allows the robot to walk forward a certain number of steps, then it doesn't matter how I changed it. The robot will still walk forward a certain number of steps. Once again, the user of the class doesn't care how the robot walks forward. He just wants the robot to walk forward when he calls the particular method. Another way that interfaces are useful is be using them as types. An interface is a reference type. Similar to how we say int m = 8, or person p1 = new person(); the 'int' and 'person' are both reference types. If I have an interface called robotMovable, then I can say robotMovable r1 = new Robot(); Notice that the robotMovable is the reference type and the Robot(); is creating a type of robot. We cannot say robotMoves r1 = new robotMoves(); because a interface can not be instantiated. The importance of using interfaces as types probably isn't clear from my explanation. I encourage you to read about using interfaces as types in the oracle java tutorials and read about it on stack overflow. That should help. There are other reasons for interfaces, but these are some of the main ones. What I have explained isn't necessarily what interfaces were made for, but interfaces are extremely useful in the scenarios I have described. I hope this clarifies it somewhat.
@akashnishad81288 жыл бұрын
thanks a lot sir
@A5mis5 жыл бұрын
You're good, so good
@gauravjha25588 жыл бұрын
can u explain in below paragraph bit detail --------- "a class usually represents one concept ,but it can do many action"
@deegeu8 жыл бұрын
+Gaurav Kumar A class usually represents on thing. For example, the class could represent a car. The car can do many things (actions) like start, drive, stop, turn, etc..
@8o8inSquares6 жыл бұрын
Thanks!
@pradeephero18 жыл бұрын
Thanks
@andreviniciusbezerradasilv9335 Жыл бұрын
thx
@mahichasnalla7 жыл бұрын
where the details of marker interface are define
@ballads77745 жыл бұрын
THANK YOU
@xs10z4 жыл бұрын
Yet another learning video with music in the background. When you were in school, did they play music during lectures? No? Why not? Why is this different?
@samsegurazramyi3143 жыл бұрын
I am also watching this video while wearing only underwear, which I couldn't do either while attending lectures. Yeah, this way of learning is different from lectures, and it is different for the better. Go to any educational video on youtube, and I mean ANY educational video, and you will read many comments saying something like "I swear I learn more in KZfaq than in school".
@kisnasur21457 жыл бұрын
when we use builtin Interface like comparable, runnable...., why we don't have to override their methods and don't have to impements all the methods of that Interface.
@deegeu7 жыл бұрын
You do need to implement all the methods. So if your class implements Comparable, you must provide the comareTo method. If you implement the Runnable method, you must provide a run method.
@wdabrilvi7 жыл бұрын
Hi, i am wondering: why are so important? i can simply ignore it and program like "interfaces" doesnt even exist. but everysingle time i try to read some java code they are all around.
@rolland496 жыл бұрын
Wow! The popularity and usability of functional programming has now becomne a feature in Java 8. But I was unaware that "defender methods" were a concept created to insure regression. Java has always been the classical school of OOP coding; e.g. class definitions. I hope future releases will have a better solution than the concept of "defender methods".
@ethan94356 жыл бұрын
Excellent tutorial. Please correct me if I'm wrong; my understanding for the application of interface is that it is used to standardize functionality across selected classes. Is that true?
@computerscience9017 жыл бұрын
What is package scope ?
@deegeu7 жыл бұрын
When you define a class if you leave out the scope modifier (public, private, or protected), the default is "package" scope. That means subclasses and other classes cannot access your new class, unless the class is in the same package.
@computerscience9017 жыл бұрын
O right. I get you. Thanks.
@saimhassan6 жыл бұрын
Awesome!
@mdzahidulislam29808 жыл бұрын
Great Tutorial.:)
@deegeu8 жыл бұрын
+MD Zahidul Islam Thank you for watching!
@xAjido5 жыл бұрын
Had to watch this at 0.75 speed. Slow down friend
@fluffy245 жыл бұрын
Same thing!
@pseudooduesp28056 жыл бұрын
hi i am sorry but that language stay verbose and oop for me it realy havy processing , when use interface when use abstract class why it 's not clear.
@speedbumphu5 жыл бұрын
Good tutorial although I have a question: why an earth does someone wear two tshirts at a time?
@somedude54144 жыл бұрын
Looks like he's in Colorado in December. Maybe he wanted to avoid data shrinkage.
@gauravjha25588 жыл бұрын
how interface hiding details of class ........please explain me
@deegeu8 жыл бұрын
+Gaurav Kumar An interface is just a list of method calls. You cannot see any implementation details when calling the interface from another class. You may not even know what class instance is used.
@fatihersoy75594 жыл бұрын
@@deegeu Forgive my ignorance, but why do we need interfaces instead of just implementing in the related classes?
@googlygates7 жыл бұрын
hey you are too good!!!
@harshalpaturkar28147 жыл бұрын
please Explain me what does "Program to interface" means ??
@deegeu7 жыл бұрын
It means that you create an interface, and when you need to use a class behind the interface, you only access the interface. Not the concrete class. Your code should only call the methods exposed by the interface. A good example is exposing a list of data as a List (interface), but behind the scenes the class is an ArrayList (class).
@harshalpaturkar28147 жыл бұрын
thanx a lot sir,and seriously, I'm following ur java video, the explanation is really good
@DrSaav-my5ym2 жыл бұрын
I am still very very confused, I don't see the point of interfaces, very difficult concept to understand for a beginner
@hebrux6 жыл бұрын
awsome
@junaidtanoli18 жыл бұрын
Nice tuts ! .. where is next video ?
@deegeu8 жыл бұрын
+Junaid Tanoli It's coming soon. Holidays in the US have disrupted my schedule, but I should have at least one this week. Thanks for watching!
@arrogantermistkerl45795 жыл бұрын
As I understood Interfaces dont usually have their methods imolemented. Especially not before Java SE 7."All methods of an Interface do not contain implementation (method bodies) as of all versions below Java 8. Starting ". Im citing: en.m.wikipedia.org/wiki/Interface_(Java). If that is correct I just dont understand where for example the method next()from the Iterator interface in the linkedList is implented . Because I dont see the method Next() it in the documentation of the LinkedList. docs.oracle.com/javase/7/docs/api/java/util/LinkedList.html. Can you pls explain or link to a video that does Thanks alot for the super content btw.
@jefflee7385 жыл бұрын
good good good
@user-iu9ko7cn6d8 жыл бұрын
Subscribed!Very nice work,i'm gonna check your channel..Thanks :D
@deegeu8 жыл бұрын
Thanks for watching!
@user-iu9ko7cn6d8 жыл бұрын
Hehehe no prob,thanks for existing ^^
@yes_cassi6 жыл бұрын
before I thank you for the lovey explanation...why are you wearing two t-shirts?????
@PapatsoMopaka5 жыл бұрын
To make his data look big hahahaha
@gyaseddintanrkulu6 жыл бұрын
Yeah, I have a lot of questions. Number one: Why is Java so hard?
@Sear-hh4gf3 жыл бұрын
What the heck is that music in the background for?!!!!!!