Check out our courses:
Enterprise Java Spring Microservices: go.telusko.com...
Coupon: TELUSKO10 (10% Discount)
Master Java Spring Development : bit.ly/java-sp...
Coupon: TELUSKO20 (20% Discount)
For More Queries WhatsApp or Call on : +919008963671
website : courses.telusk...
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 : github.com/nav...
Java:- bit.ly/JavaUde...
Spring:- bit.ly/SpringU...
More Learning :
Java :- bit.ly/3x6rr0N
Python :- bit.ly/3GRc7JX
Django :- bit.ly/3MmoJK6
JavaScript :- bit.ly/3tiAlHo
Node JS :- bit.ly/3GT4liq
Rest Api :-bit.ly/3MjhZwt
Servlet :- bit.ly/3Q7eA7k
Spring Framework :- bit.ly/3xi7buh
Design Patterns in Java :- bit.ly/3MocXiq
Docker :- bit.ly/3xjWzLA
Blockchain Tutorial :- bit.ly/3NSbOkc
Corda Tutorial:- bit.ly/3thbUKa
Hyperledger Fabric :- bit.ly/38RZCRB
NoSQL Tutorial :- bit.ly/3aJpRuc
Mysql Tutorial :- bit.ly/3thpr4L
Data Structures using Java :- bit.ly/3MuJa7S
Git Tutorial :- bit.ly/3NXyCPu
Donation:
PayPal Id : navinreddy20
www.telusko.com
Негізгі бет Ғылым және технология #57 Final keyword in java
Пікірлер: 22