Hello, in this Java programming video, we are going to take a look at interfaces. So interfaces are very similar to a class they inherit from, or more specifically an abstract class, which is what we did in the previous video. So if you haven't checked that, feel free to go and have a look at that and then pop back. Yeah. Okay, so interface the main differences, or a regular class or an abstract class, the class setting has come from it can only inherit from one class, an interface However, a class can inherit from multiple interfaces. And a interface can also inherit from an interface as well.
But a class can inherit from a class that can inherit, but you can't have one class they inherit from multiple classes. So you can inherit from multiple interfaces. So that's one difference. The other differences you don't have any variables in there. So we remove these will get error in the well. The other one you don't integrate meant the actual method themselves.
In the class, they're always implemented in the interfaces if ik abstract class with no variables where everything is a sub struct, so instead of abstract class Yeah, put interface, get rid of abstract this should give us several arrows. So an enemy, what is sine? So this is we need to remove that. Okay, so yep, that's the other thing that extends you the keyword implements here as well. And the other thing is, because you can't have a variable in there, you have to create the variable here. So we'll create a variable Okay, we need a live as well.
So by default and in Java, so Oh yeah, we don't have. So if we go back here, which might be public, otherwise you could you can morphism and use getters and setters, which I've already showed you how to do. And we can actually do that because if we have the most private, they forgot sonar system Java. They say add a getter and setter for the methods. So it's changed their own instances to get in cetera, and in enemy that is a getter and setter method as well. rejection free stuff, I just fix that.
And what are the signs less low. So that's the on chain visibility or just automatically add a different setup. As the beauty of using an ID we have powerful Eclipse, it can be a bit slow sometimes on older computers, compared to some other IDs. But it is very, very powerful. So if you want, and yeah, it's working. So that's it for interfaces.
Yeah, one other thing you might notice as a learner I here just in case an interface. The other thing I want to show you, if you had another interface to where you would, you know, sort of implement the other one you just put comma and the name of the that's what you do, don't have one can do it by the next test. Feel free to create an interest in a whole nother foil and inherit or implemented in just one of these classes. So that's it. Thanks for watching, and I look forward to seeing you in the next awesome video.