MENU

Fun & Interesting

#57 Final keyword in java

Telusko 123,293 2 years ago
Video Not Working? Fix It Now

Check out our courses: Java Full Stack and Spring AI - https://go.telusko.com/JavaSpringAI Coupon: TELUSKO10 (10% Discount) DevOps with AWS: From Basics to Mastery : https://go.telusko.com/DevOpsAWS Coupon: TELUSKO10 (10% Discount) Master Java Spring Development : https://go.telusko.com/masterjava Coupon: TELUSKO20 (20% Discount) For More Queries WhatsApp or Call on : +919008963671 website : https://courses.telusko.com/ In this video we are talking about final keyword: -- final keyword use with variable , methods and class -- if make a variable final then variable become constant final int a=5; //you cannot reassign a value to a -- final class class A{ public void show(){ System.out.println("In Calc show); } public void add(int a,int b){ System.out.println(a+b); } } Suppose someone want to extend your class , but we want to stop inheritance then we need to make final -- if you make class final then no one can inherite your class -- but you can use the final class by making object of final class class A{ public final void show(){ System.out.print("IN A"); } } class B extends A{ // but you inherit class but you cannot override show() method if your method is final //since show method is final } -- if you make method as final no one can override your method. Github repo : https://github.com/navinreddy20/Javacode.git Java:- https://bit.ly/JavaUdemyTelusko Spring:- https://bit.ly/SpringUdemyTelusko More Learning : Java :- https://bit.ly/3x6rr0N Python :- https://bit.ly/3GRc7JX Django :- https://bit.ly/3MmoJK6 JavaScript :- https://bit.ly/3tiAlHo Node JS :- https://bit.ly/3GT4liq Rest Api :-https://bit.ly/3MjhZwt Servlet :- https://bit.ly/3Q7eA7k Spring Framework :- https://bit.ly/3xi7buh Design Patterns in Java :- https://bit.ly/3MocXiq Docker :- https://bit.ly/3xjWzLA Blockchain Tutorial :- https://bit.ly/3NSbOkc Corda Tutorial:- https://bit.ly/3thbUKa Hyperledger Fabric :- https://bit.ly/38RZCRB NoSQL Tutorial :- https://bit.ly/3aJpRuc Mysql Tutorial :- https://bit.ly/3thpr4L Data Structures using Java :- https://bit.ly/3MuJa7S Git Tutorial :- https://bit.ly/3NXyCPu Donation: PayPal Id : navinreddy20 https://www.telusko.com

Comment