Enter your E-mail Address below for Free E-mail Alerts right Into your Inbox: -

Sunday

What is Final keyword in java

What is Final keyword in java

Normally final keyword is used to make something immutable in java. Final keyword can be applied to Class,Method,Variables etc.

EX:- For class
public final class Test {


void comparaeAll()
{

}
static final   String lockAll()
{
return "cvfsdgsd";
}

}

In the above program the class can't be extended or modified.

EX:-
public static final int pi = 3.14;

No comments:

Post a Comment