Hello, in this video we are going to use the final keyword. So I've got this little class called car, let me create a new Java class called BMW which is going to extend the call class. And it gets all of its public and protected attributes you know the variables and functions, simple stuff, you want to know more about it, feel free to check out you know, the other videos are covered in this section in this series, all we can do is override you know, the functionality of a particular function which is you know, covered in a separate video. So feel free to have a look at that before the public actually wants a click leave it as it is. And if I change this to new BMW, and I do call OBJ and on a call. I do that.
We get open door so he calls its parents method is inherited. I can override it by doing public function, open door, pay for one the same name. But let's say one of the child classes wants to implement it slightly differently. In this instance, multi door is opening up a line tag. Now if I reload it, it's a door is opening. But if I don't want the parents class to be overridden if I want to prevent that, so this is the final essential, you know, method implementation.
You've put the keyword fine not to stop. Now for reload, we get an error that is online. 22. Yep, not sort of, you know this in general, it's saying that open door, you cannot override the final method. So you can think of like this almost like the way you might have a static variable. This is sort of like that.
This is saying this is the final function cannot Be over it and you can still use it. Focus Don't do this. And that's fine. He also inherited and he used to still using the normal way before and prevents you from overriding the method in a child class. Nothing more to the final keyword than that. If you have any questions as usual, feel free to shoot me a message and I look forward to seeing you in the next video.